Monday, November 16, 2009

[.NET] How to swallow warnings

Well aware this is against all best practices, here's how you suppress all warnings coming from a given region of code:

#pragma warning disable

//All the warnings in here are swallowed!

#pragma warning restore

This is way beyond cool - and might help you out when you can't change your code but you're being hovered by a frustrating policy of ZERO WARNING TOLERANCE.

Go forth and get it done.

No comments: