如何在以下内容中忽略特定的VS代码分析规则(例如CA1305:Microsoft.Globalization):
方法?
类?
命名空间?
(假设这些选项都是可能的.)
您可以像这样使用SupressMessage属性: -
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2233:OperationsShouldNotOverflow", MessageId = "newValue+1", Justification = "The reason I think its acceptable in this case")] void SomeMethod() { // Some code that would normal cause this Code Analysis message }
关于方法,属性,类型等