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 2,229 other followers

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 #if syntax, and I hardly use #pragma.

Contrary to #if#endif, 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).


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

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

%d bloggers like this: