title: How to get columns of a datatable by column number or position
body: <p>I am new to C#. I know how to get it by using a simple for each loop as shown below. Can you show me how to get it by position/index/column number ?</p>
  
  <pre><code>foreach (DataRow row_ in dt.Rows){
    row = row_;
    foreach (DataColumn col_ in dt.Columns){
      col = col_;
      strMsg = strMsg + col.ColumnName + ": " + row[col.Ordinal].ToString() 
               + Environment.NewLine;
    }
    MessageBox.Show(strMsg);
    strMsg = "";
  }
  </code></pre>