CompressionFormatHelper.cs 770 B

1234567891011121314151617181920212223242526
  1. // <copyright>
  2. // Copyright (c) Microsoft Corporation. All rights reserved.
  3. // </copyright>
  4. namespace System.ServiceModel.Channels
  5. {
  6. using System.ComponentModel;
  7. internal static class CompressionFormatHelper
  8. {
  9. public static void Validate(CompressionFormat value)
  10. {
  11. if (!IsDefined(value))
  12. {
  13. throw FxTrace.Exception.AsError(new InvalidEnumArgumentException("value", (int)value, typeof(CompressionFormat)));
  14. }
  15. }
  16. internal static bool IsDefined(CompressionFormat value)
  17. {
  18. return
  19. value == CompressionFormat.None
  20. || value == CompressionFormat.Deflate
  21. || value == CompressionFormat.GZip;
  22. }
  23. }
  24. }