You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
CC0019 (Convert to switch) suggests the code transformation even for if statements that have a break statement in the body of one of the clauses.
Example
varstr="aaaaa";for(vari=0;i<5;i++){varc= str[i];if(c=='a')
Console.WriteLine("It's an A.");elseif(c=='b')break;elseif(c=='c')
Console.WriteLine("It's a B.");else
Console.WriteLine("It's not an A nor B.");}
Current output after fix applied
varstr="aaaaa";for(vari=0;i<5;i++){varc= str[i];switch(c){case'a':
Console.WriteLine("It's an A.");break;case'b':// The break statement's behavior cannot be preserved// when the if statement is converted to a switch statement.break;break;case'c':
Console.WriteLine("It's a B.");break;default:
Console.WriteLine("It's not an A nor B.");break;}}
Expected behavior
CC0019 is not raised.
The text was updated successfully, but these errors were encountered:
Summary
CC0019 (Convert to
switch
) suggests the code transformation even for if statements that have abreak
statement in the body of one of the clauses.Example
Current output after fix applied
Expected behavior
CC0019 is not raised.
The text was updated successfully, but these errors were encountered: