DataRow efficient lookup for column index of a cell with a certain value

Hi, what’s the most efficient way to look up the column index of a cell which has a certain content?

  • I have a DataRow (not a DataTable)
  • I know that it contains a certain value e.g. “First Name”
  • Based on that value, find the column index which contains the value
  • Do this as efficiently as possible, preferably without looping

@DEATHFISH Try like below, it might be useful.


where “row” is datarow and “mys” is search value.

Hi, how do I modify this to take into account case differences and whitespace?

E.g. “Mys” , “myS”, " mYs" etc.