解释 System.Diagnostics.CodeAnalysis.SuppressMessage [英] Explain System.Diagnostics.CodeAnalysis.SuppressMessage

查看:31
本文介绍了解释 System.Diagnostics.CodeAnalysis.SuppressMessage的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在某些应用程序中有这种代码(来自微软)

I have this kind of code in some applications (from microsoft)

[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage(
  "Microsoft.Naming", 
  "CA1702:CompoundWordsShouldBeCasedCorrectly", 
  MessageId = "CounterClockwise", 
  Scope = "member", 
  Target = "ScePhotoViewer.PhotoDisplayControl.#RotatePhotoCounterClockwiseCommand"
)]

  • 谁能给我解释一下?
  • 是否有任何博客解释如何使用它,真正的好处...
  • 谢谢乔纳森

    推荐答案

    此属性由 Team Foundation Server 使用 (TFS) 的代码分析功能可以排除会触发警告的代码片段.如果您不使用 TFS 代码分析,则可以安全地删除它们.

    This attribute is used by Team Foundation Server's (TFS) code analysis functionality to exclude code fragments that would otherwise trigger warnings. You can safely remove them if you're not using TFS code analysis.

    属性可以手动添加,或者更常见的是在错误列表中选择抑制消息"选项时通过 Visual Studio GUI 自动添加.

    The attributes can be added by hand or, more usually, are added automatically via the Visual Studio GUI when the "Suppress Message" option is selected in the error list.

    这篇关于解释 System.Diagnostics.CodeAnalysis.SuppressMessage的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆