I have this code:
int someValue = 100;
if (x == 5)
{
if (someCondition)
{
return someValue;
}
return someValue / 12;
}
if (x == 6)
{
if (someCondition)
{
return someValue * 12;
}
return someValue;
}
如您所见,someCondition 总是相同的,只有返回值不同。是否有更简单的方法来进一步简化这个过程?