Code inspection: Duplicated switch section bodies
This inspection reports cases of a switch
that contain the same statements. ReSharper suggests merging such cases to improve readability and maintainability of the code.
public static void SwitchTest(int i)
{
switch (i)
{
case -1:
Console.WriteLine("not null"); break;
case 1:
Console.WriteLine("not null"); break;
}
}
public static void SwitchTest(int i)
{
switch (i)
{
case -1:
case 1:
Console.WriteLine("not null"); break;
}
}
Last modified: 08 November 2024