Eric covers another new C# Whidbey (VS 2005) feature


Not a long post (I’ve included it all below), but useful nonetheless

C# Featurette #2 – Inline Warning Control

Another feature that we added for Whidbey is the ability to selectively disable warnings within your code. For example:

#pragma warning disable 135

  // Disable warning CS135 in this block

#pragma warning restore 135

Comments on this feature? Click on the “Featurette” link above and tell Eric what you think!

Comments (1)

  1. Hannes Eder says:

    what about nesting of #pragma-stmts?

    #pragma warning disable 135

    // some code

    #pragma warning disable 135

    // Disable warning CS135 in this block

    #pragma warning restore 135

    // is the warning here enabled or not?

    // it might be usefull, to have nesting-

    // levels, but maybe an other syntax to

    // support this mechanism is needed

    // like the one used be vc++

    #pragma warning restore 135

    using the vc++ #pragma warning syntax would the best solution I guess.