Optimizing if else statements

studio

#1

Hi all

i had to loop through a datatable and check if cells matches certain values:
1-Read the second row cell(indexed by it’s colum name)
2-For each type found, eg: type1, type2: do a check in other cells (indexed with different colum name)
I’m using if statement and the treatment took 2 minute, i want to reduce this time:

row(“Type “).ToString.Contains(”[A]”) OR row(“Type “).ToString.Contains(”[B]”) OR row(“Type “).ToString.Contains(”[C”) OR row(“Type “).ToString.Contains(”[D]”) OR row(“Type “).ToString.Contains(”[E]”)


#3

@abdel, Try with LinQ

will convert your filtered table to a dataTable


#7