[我搜索过类似的问题,但大多数似乎至少有 5 年的历史。最接近的似乎是这个答案,但答案不明确,已经 5 岁]
我的问题:如果我们希望 Visual Studio 在 IDE 中显示 (I)Disposable 变量和具有不同颜色(或以某种方式在视觉上引人注目)的属性,我们应该怎么做?例如,我在 VisualStudio 中轻松发现了所有此类情况:
var x = new XYZ(); //XYZ has .dispose() method
// or
var x = otherType.ToXYZ();
// or
var x = anotherVariableFromOtherClass; //so this `anotherVariable` has also dispose()
我已经尝试过 Resharper(但无法使用上面提到的答案)。我也可以在 Resharper 之外使用免费/简单的方法。