title: Get index of row in datatable where a variable is equal
body: <p>I have a Datatable</p>
  
  <pre><code>     DataTable dt = new DataTable();
          dt.TableName = "Player"; 
          dt.Columns.Add("PlayerNo", typeof(int));
          dt.Columns.Add("[2PMissed]", typeof(int));           
          dt.PrimaryKey = new[] { dt.Columns["PlayerNo"] };
  </code></pre>
  
  <p>and I fill the rows from a list "Homelist"</p>
  
  <pre><code>    dt.Columns.Add(dc1); dt.Columns.Add(dc2); dt.Columns.Add(dc3); dt.Columns.Add(dc4);
          for (int i = 0; i &lt; Homelist.Count; i++)
          {
              dt.Rows.Add(Homelist[i].Key, Homelist[i].Value, Homelist[i].Value.Substring(0, 2), 0);                
          }
  </code></pre>
  
  <p>Also there is another list "events".I get an int value and store it to "plId".
  I want to get the index of the row of Datatable "dt" where the column "PlayerNo" of dt is equal to "plId" variable.</p>
  
  <pre><code>                int plId = events[i].PlayerId;                    
                  int index = dt.Rows.IndexOf(dt.Rows.Find(plId));
  </code></pre>
  
  <p>The PlayerNo column gets unique values(is ID).</p>
  
  <p>I change the datatable definition and I use primary key.Then I use find() method and fix the problem
  as here <a href="https://stackoverflow.com/questions/10121747/get-the-row-next-to-the-row-got-with-datatable-select">Get the row next to the row got with DataTable.Select()</a></p>