The Wiert Corner – irregular stream of stuff

Jeroen W. Pluimers on .NET, C#, Delphi, databases, and personal interests

  • My badges

  • Twitter Updates

  • My Flickr Stream

  • Pages

  • All categories

  • Enter your email address to subscribe to this blog and receive notifications of new posts by email.

    Join 1,860 other subscribers

C# – Kirk Evans Blog : Suppress warnings in C# 2.0

Posted by jpluimers on 2010/01/05

I always forget the pragma syntax, because it differs substantially from the syntax, and I hardly use #pragma.

Contrary to , there is no #pragma#endpragma.
Instead, there is #pragma warning disable ### #pragma warning restore ###).

Ken Evans wrote a nice blog article about it (a long time ago, but it is still current): Kirk Evans Blog : Suppress warnings in C# 2.0.
And of course: the official docs, which indicate that when you omit the  warning list in a #pragma warning restore, then all warnings are restored.

You can get the error numbers from the compiler output window (no, the errors/warnings/hints window does not show the numbers, that would be to obvious).

–jeroen

Leave a comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.