我如何忽略特定的 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
}
关于方法、属性、类型等。
关于visual-studio - 忽略 Visual Studio 中的代码分析规则,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1445415/