[Mono-devel-list] Re: System.XML warning

John Luke john.luke at gmail.com
Thu Mar 17 11:00:38 EST 2005

On Thu, 2005-03-17 at 06:45 -0800, Kelly Leahy wrote:
> Hi all...

> Marek, while we are adding new compiler warnings, can
> we have some way to "hide" the warnings on an
> individual symbol basis?  It seems to me that our goal
> should be to get rid of all warnings one way or
> another.  If the warning is coming up because we
> haven't used a function we know we will use later,
> it'd be nice to attach an attribute to that function,
> for instance, that tells our compiler not to show a
> warning when this function is private and unused.  If,
> on the other hand, we messed up and just ended up
> having a private symbol that we wont use, it'd be nice
> to get a message on that one.
mcs supports the C# 2 pragma stuff to disable/restore warnings
on a given section of code. (It is possible this is not in the 1.0.X
branch yet, I didn't check)

You can do it like this:
#pragma warning disable 0169
string bar;
#pragma warning restore 0169

More information about the Mono-devel-list mailing list