C# / Csharp Foreach DataTable example

Quick way to foreach datatable using C# / Csharp example.

Example:

using System; using System.Data; public class ForEachDataTableExample { public static void Main() { //adding up a new datatable DataTable dtEmployee = new DataTable("Employee"); //adding up 3 columns to datatable dtEmployee.Columns.Add("ID", typeof(int)); dtEmployee.Columns.Add("Name", typeof(string)); dtEmployee.Columns.Add("Salary", typeof(double)); //adding up rows to the datatable dtEmployee.Rows.Add(52, "Human1", [...]