-
Notifications
You must be signed in to change notification settings - Fork 4.2k
Closed
Labels
Area-IDEBugFeature - IDE0066Convert switch statement to expressionConvert switch statement to expressionhelp wantedThe issue is "up for grabs" - add a comment if you are interested in working on itThe issue is "up for grabs" - add a comment if you are interested in working on it
Description
Version Used:
Steps to Reproduce:
class Program
{
public object M(int i, string j)
{
switch (i, j)
{
case (0, _):
return true;
case (_, null):
return true;
default:
return false;
}
}
}Diagnostic Id:
"IDE0066: Use 'switch' expression"
Expected Behavior:
class Program
{
bool M(int i, string j)
{
return (i, j) switch
{
(0, _) => true,
(_, null) => true,
_ => false,
};
}
}Actual Behavior:
class Program
{
public object M(int i, string j)
{
return (i, j)
switch
{
(0, _) => true,
(_, null) => true,
_ => (object)false,
};
}
}Metadata
Metadata
Assignees
Labels
Area-IDEBugFeature - IDE0066Convert switch statement to expressionConvert switch statement to expressionhelp wantedThe issue is "up for grabs" - add a comment if you are interested in working on itThe issue is "up for grabs" - add a comment if you are interested in working on it