Locked switch statements should have default label as the last label

  • Thursday, April 19, 2012 10:06 AM
     
     
    switch statements should have default label as the last label::is  FxCop rule for this is possible in Fxcop 10.0 as it was not possible in older version.

    if possible can any1 provide me the custom Fxcop rule source coe for this

    • Moved by CoolDadTxMVP Thursday, April 19, 2012 1:56 PM Code analysis related (From:Visual C# General)
    •  

All Replies

  • Thursday, April 19, 2012 10:51 AM
     
     

    The Switch statement can be optimized in many different ways (small switch/case statements result in if/else, large statements are converted to a HashSet). So it will not be possible to check this from the compiled code. Instead you should use a StyleCop rule. They have a dedicated forum for these kinds of questions.

    http://stylecop.codeplex.com/discussions


    My blog: blog.jessehouwing.nl