[Solved] C# Dynamic IF Else Statment [closed]


I’m going to guess you are asking how to test multiple items in a collection of unknown size. If so:

bool isMatch = true;
string valueToCompare = "some value";

for( int i = 0; i < allrowcol.Length; i++ ){
   if( allrowcol[i] != valueToCompare ){
       isMatch = false;
       break;
   }
}

if( isMatch ){
    // do something
}

Alternatively, if you just want to test all values at once, then concatenate them, e.g. using string.Join(). See this question: C#: string[] to delimited string. Is there a one-liner?

3

solved C# Dynamic IF Else Statment [closed]