C# Compiler should give warning but doesn't?

后端 未结 7 1141
北恋
北恋 2020-12-03 14:05

Someone on my team tried fixing a \'variable not used\' warning in an empty catch clause.

try { ... } catch (Exception ex) { }

-> gives a w

7条回答
  •  春和景丽
    2020-12-03 14:53

    The variable s is used... to hold a reference to ex.Message. If you had just string s; you would get the warning.

提交回复
热议问题