How do I get rid of “[some event] never used” compiler warnings in Visual Studio?

前端 未结 7 1547
伪装坚强ぢ
伪装坚强ぢ 2020-12-23 20:08

For example, I get this compiler warning,

The event \'Company.SomeControl.SearchClick\' is never used.

But I know that it\'s use

7条回答
  •  渐次进展
    2020-12-23 20:50

    You can supress individual warnings.

    \Program.cs(13,20): warning CS0219: The variable 'foo' is assigned but its value is never used
    

    In this case, CS0219 is the warning regarding variables being assigned but not used. You can either use the /nowarn:0219 flag, or add the error number in the properties pane for the project (under "Build", remember to remove the leading CS). Keep in mind the supresses all warnings of this class.

提交回复
热议问题