c# - 为什么 C# 代码在 Visual Studio 2015 编辑器中部分变灰?

标签 c# visual-studio

<分区>

这是示例 C# 代码在我的 VS 2015 配置中的样子:

enter image description here

矩形中的语句是灰色的。这是什么意思? Per this SO answer , 我知道 References->Analyzers 下有规则,但我不知道哪个事件规则产生了这个结果。

编辑:

Per Hans Passant 的指导:

enter image description here

最佳答案

分析器建议您的代码即使没有这些行也能正常运行。

我假设它能够确定 TickFinished 永远不会 null。您引入的变量也是多余的。

关于c# - 为什么 C# 代码在 Visual Studio 2015 编辑器中部分变灰?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44475391/

相关文章:

c# - linq2db 更新找不到 .Set 方法 MySQL 的定义

c# - 如何修复 "The provider is not compatible with the version of Oracle client"?

c# - WPF 创建全局 WinSCP session

c++ - 是否有用于 Visual Studio 的工具来跟踪(或中断)变量值?

c# - 'Microsoft.Owin' 上的 FileLoadException

c# - 声明静态类,以便它们可以存储在列表中

C# SQL SELECT WHERE <variable> LIKE %Column% - 格式?

c# - 停止 visual studio 将 .DLL 文件放入/调试

visual-studio - XSLT 1.0 修改配置文件替换功能

c# - 如何在 Visual Studio 中执行 Ctrl+K、Ctrl+F?