How to get rid of Naming rule violation messages in Visual Studio?

后端 未结 9 614
我在风中等你
我在风中等你 2020-12-14 05:10

I just installed Visual Studio 2017. When I open an existing website, I get all sorts of warning messages such as this one:

IDE1006 Naming rule violat

9条回答
  •  温柔的废话
    2020-12-14 05:42

    If you want to omit or void the warning message in a method, you can use the SuppressMessage from the namespace System.Diagnostics.CodeAnalysis:

    [SuppressMessage("Microsoft.Design", "IDE1006", Justification = "Rule violation aceppted due blah blah..")]
    

    The Justification property is optional, but it's worth spending a moment writing a reason, to let your team know that the code is revised and is ok.

提交回复
热议问题