Unable to add multiple conditions in switch statement.
How to do this using a switch statement? do i have to use multiple if conditions?
string oldValue = ".....long string1....";
string newValue = ".....long string2....";
switch (oldValue.Length && newValue.Length)
{
case <500 && <500:
//insert as is
break;
case >500 && <500:
//split oldValue into array of strings and insert each
//insert newValue as is
break;
case <500 && >500:
//insert oldValue As is
//split newValue into array of strings and insert each
break;
case >500 && >500:
//split oldValue into array of strings and insert each
//split newValue into array of strings and insert each
break;
default:
break;
}
Looking at your comments, the length of
oldValueonly affects what you do witholdValue, and the length ofnewValueonly affects what you do withnewValue.Why not split this into two separate statements? Or even into a common method?