Код: Выделить всё
bool result = true;
bool isTrue = false;
CheckIsTrue(ref isTrue);
if (result)
{
if (isTrue)
//Perform action
}
Код: Выделить всё
if (result)
{
if (isTrue)
{
//Perform action
}
else if(actionType == 6)
{
//Perform action, isTrue = false.
}
}
Код: Выделить всё
if (result)
{
switch (isTrue)
{
case true:
//perform action on isTrue
break;
default:
switch (actionType)
{
case 6:
//Perform action on 6
break;
default:
//Perform default action
break;
}
break;
}
}
Это лучший способ упростить мой код, который я рассматривал, однако я не уверен, насколько он верен.
Подробнее здесь: https://stackoverflow.com/questions/538 ... n-variable
Мобильная версия