title: Get row index in datatable from a certain column
body: <pre><code>| 1 | 2 | 3 |
  +------------+
  | A | B | C |
  | D | E | F | 
  | G | H | I |
  </code></pre>
  
  <hr>
  
  <pre><code>System.Data.DataTable dt = new DataTable();
  
  dt.Columns.Add("1");
  dt.Columns.Add("2");
  dt.Columns.Add("3");
  dt.Rows.Add(new object[] { "A", "B", "C" });
  dt.Rows.Add(new object[] { "D", "E", "F" });
  dt.Rows.Add(new object[] { "G", "H", "I" });
  
  int? index = null;
  
  var rows = new System.Data.DataView(dt).ToTable(false, new[] {"1"}).Rows;
  
  for (var i = 0; i &lt; rows.Count; i++)
  {
      if (rows[i].ItemArray.FirstOrDefault() as string == "A")
          index = i;
  }
  </code></pre>
  
  <p>Is there any way to simplify this code for fetching the index of a certain row, with a column provided? In this case, index will be <code>0</code>, since I'm iterating through the first column until i find "A". Feels like there should be a linq solution to this, but I can't figure it out.</p>