SuppressMessageAttribute.cs 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. // Licensed to the .NET Foundation under one or more agreements.
  2. // The .NET Foundation licenses this file to you under the MIT license.
  3. // See the LICENSE file in the project root for more information.
  4. /*============================================================
  5. **
  6. **
  7. **
  8. ** An attribute to suppress violation messages/warnings
  9. ** by static code analysis tools.
  10. **
  11. **
  12. ===========================================================*/
  13. namespace System.Diagnostics.CodeAnalysis
  14. {
  15. [AttributeUsage(
  16. AttributeTargets.All,
  17. Inherited = false,
  18. AllowMultiple = true
  19. )
  20. ]
  21. [Conditional("CODE_ANALYSIS")]
  22. public sealed class SuppressMessageAttribute : Attribute
  23. {
  24. public SuppressMessageAttribute(string category, string checkId)
  25. {
  26. Category = category;
  27. CheckId = checkId;
  28. }
  29. public string Category { get; }
  30. public string CheckId { get; }
  31. public string? Scope { get; set; }
  32. public string? Target { get; set; }
  33. public string? MessageId { get; set; }
  34. public string? Justification { get; set; }
  35. }
  36. }