#1,127 – Where to Find Compiler Warning Numbers

You can use #pragma warning to selectively disable certain warnings that occur when compiling your code.

The #pragma warning line requires knowing the specific warning number, which is not displayed in the list of warnings on the Error List tab.


To find the warning number, you need to switch to the Output tab and look at the full text of the warning.  In the example below, we see that the warning about an event that is never used is warning #67.


Once you know the warning number, you can use it with a #pragma warning.

#pragma warning disable 67
        public event EventHandler CanBarkChanged;
#pragma warning restore 67