1
Answer

IS there a better way to code this?

Sahil Dev

Sahil Dev

8y
265
1
Hi,
 
I'm coding in C# and  have a code snippet as follows;
 
 
 If load.DescriptorName.Contains("tempLoad") Or 
load.DescriptorName.Contains("tempThruThickness") Or
load.DescriptorName.Contains("NodeIDTableTempLoad") Or
load.DescriptorName.Contains("tempThruThicknessTopBottom")
 {

//do something

}
 
 
My question is:
 
Rather than having so many 'Or', is there a better way to code this?
 
Sahil
Answers (1)