title: Get current index from foreach loop
body: <p>Using C# and Silverlight</p>
  
  <p>How do I get the index of the current item in the list?</p>
  
  <p>Code:</p>
  
  <pre><code>IEnumerable list = DataGridDetail.ItemsSource as IEnumerable;
  List&lt;string&gt; lstFile = new List&lt;string&gt;();
  
  
  foreach (var row in list)
  {
    bool IsChecked = (bool)((CheckBox)DataGridDetail.Columns[0].GetCellContent(row)).IsChecked;
    if (IsChecked)
    {
  
      // Here I want to get the index or current row from the list                   
  
    }
  }
  </code></pre>
  
  <p>How to achieve this</p>