The Labs \ Source Viewer \ SSCLI \ System.Diagnostics.CodeAnalysis \ SuppressMessageAttribute

  1. // ==++==
  2. //
  3. //
  4. // Copyright (c) 2006 Microsoft Corporation. All rights reserved.
  5. //
  6. // The use and distribution terms for this software are contained in the file
  7. // named license.txt, which can be found in the root of this distribution.
  8. // By using this software in any fashion, you are agreeing to be bound by the
  9. // terms of this license.
  10. //
  11. // You must not remove this notice, or any other, from this software.
  12. //
  13. //
  14. // ==--==
  15. /*============================================================
  16. **
  17. ** Class:  SuppressMessageAttribute
  18. **
  19. **
  20. **  An attribute to suppress violation messages/warnings 
  21. **  by static code analysis tools.
  22. **
  23. **
  24. ===========================================================*/
  25. using System;
  26. namespace System.Diagnostics.CodeAnalysis
  27. {
  28.    
  29.     [AttributeUsage(AttributeTargets.All, Inherited = false, AllowMultiple = true)]
  30.     [Conditional("CODE_ANALYSIS")]
  31.     public sealed class SuppressMessageAttribute : Attribute
  32.     {
  33.         private string category;
  34.         private string justification;
  35.         private string checkId;
  36.         private string scope;
  37.         private string target;
  38.         private string messageId;
  39.        
  40.         public SuppressMessageAttribute(string category, string checkId)
  41.         {
  42.             this.category = category;
  43.             this.checkId = checkId;
  44.         }
  45.        
  46.         public string Category {
  47.             get { return category; }
  48.         }
  49.        
  50.         public string CheckId {
  51.             get { return checkId; }
  52.         }
  53.        
  54.         public string Scope {
  55.             get { return scope; }
  56.             set { scope = value; }
  57.         }
  58.        
  59.         public string Target {
  60.             get { return target; }
  61.             set { target = value; }
  62.         }
  63.        
  64.         public string MessageId {
  65.             get { return messageId; }
  66.             set { messageId = value; }
  67.         }
  68.        
  69.         public string Justification {
  70.             get { return justification; }
  71.             set { justification = value; }
  72.         }
  73.     }
  74. }

Developer Fusion