BidMethodAttribute.cs 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. using System;
  2. /// <summary>
  3. /// This attribute is used by FxCopBid rule to mark methods that accept format string and list of arguments that match it
  4. /// FxCopBid rule uses this attribute to check if the method needs to be included in checks and to read type mappings
  5. /// between the argument type to printf Type spec.
  6. ///
  7. /// If you need to rename/remove the attribute or change its properties, make sure to update the FxCopBid rule!
  8. /// </summary>
  9. [System.Diagnostics.ConditionalAttribute("CODE_ANALYSIS")]
  10. [System.AttributeUsage(AttributeTargets.Method)]
  11. internal sealed class BidMethodAttribute : Attribute
  12. {
  13. private bool m_enabled;
  14. /// <summary>
  15. /// enabled by default
  16. /// </summary>
  17. internal BidMethodAttribute()
  18. {
  19. m_enabled = true;
  20. }
  21. /// <summary>
  22. /// if Enabled is true, FxCopBid rule will validate all calls to this method and require that it will have string argument;
  23. /// otherwise, this method is ignored.
  24. /// </summary>
  25. public bool Enabled {
  26. get
  27. {
  28. return m_enabled;
  29. }
  30. set
  31. {
  32. m_enabled = value;
  33. }
  34. }
  35. }