AuditLevel.cs 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. //----------------------------------------------------------
  2. // Copyright (c) Microsoft Corporation. All rights reserved.
  3. //------------------------------------------------------------
  4. namespace System.ServiceModel
  5. {
  6. using System.ComponentModel;
  7. public enum AuditLevel
  8. {
  9. None = 0,
  10. Success = 0x1,
  11. Failure = 0x2,
  12. SuccessOrFailure = Success | Failure,
  13. }
  14. static class AuditLevelHelper
  15. {
  16. public static bool IsDefined(AuditLevel auditLevel)
  17. {
  18. return auditLevel == AuditLevel.None
  19. || auditLevel == AuditLevel.Success
  20. || auditLevel == AuditLevel.Failure
  21. || auditLevel == AuditLevel.SuccessOrFailure;
  22. }
  23. public static void Validate(AuditLevel value)
  24. {
  25. if (!IsDefined(value))
  26. {
  27. throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new InvalidEnumArgumentException("value", (int)value,
  28. typeof(AuditLevel)));
  29. }
  30. }
  31. }
  32. }