PerformanceCounterScope.cs 1.2 KB

123456789101112131415161718192021222324252627282930313233343536
  1. //----------------------------------------------------------------------------
  2. // Copyright (c) Microsoft Corporation. All rights reserved.
  3. //----------------------------------------------------------------------------
  4. namespace System.ServiceModel.Diagnostics
  5. {
  6. using System.ComponentModel;
  7. public enum PerformanceCounterScope
  8. {
  9. Off = 0, // +
  10. ServiceOnly = 1,
  11. All = 2,
  12. Default = 3, // *
  13. }
  14. static class PerformanceCounterScopeHelper
  15. {
  16. internal static bool IsDefined(PerformanceCounterScope value)
  17. {
  18. return
  19. value == PerformanceCounterScope.Off
  20. || value == PerformanceCounterScope.Default
  21. || value == PerformanceCounterScope.ServiceOnly
  22. || value == PerformanceCounterScope.All;
  23. }
  24. public static void Validate(PerformanceCounterScope value)
  25. {
  26. if (!IsDefined(value))
  27. {
  28. throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new InvalidEnumArgumentException("value", (int)value,
  29. typeof(PerformanceCounterScope)));
  30. }
  31. }
  32. }
  33. }