1 DataTable dt = new DataTable();
2 DataColumn colunmStop = new DataColumn("StopName", typeof(string));
3 dt.Columns.Add(colunmStop);
4 DataColumn columnTime = new DataColumn("StopTime", typeof(TimeSpan));
5 dt.Columns.Add(columnTime);
6
7
8 for (int i = 0; i < 10; i++)
9 {
10 DataRow row = dt.NewRow();
11 row["StopName"] = i.ToString();
12 row["StopTime"] = Convert.ToDateTime("9:20:00").TimeOfDay;
13 dt.Rows.Add(row);
14 }
15
16 foreach(DataRowView drv in dt.DefaultView)
17 {
18 Console.WriteLine(drv[0].ToString());
19 Console.WriteLine(drv[1].ToString());
20 }
2 DataColumn colunmStop = new DataColumn("StopName", typeof(string));
3 dt.Columns.Add(colunmStop);
4 DataColumn columnTime = new DataColumn("StopTime", typeof(TimeSpan));
5 dt.Columns.Add(columnTime);
6
7
8 for (int i = 0; i < 10; i++)
9 {
10 DataRow row = dt.NewRow();
11 row["StopName"] = i.ToString();
12 row["StopTime"] = Convert.ToDateTime("9:20:00").TimeOfDay;
13 dt.Rows.Add(row);
14 }
15
16 foreach(DataRowView drv in dt.DefaultView)
17 {
18 Console.WriteLine(drv[0].ToString());
19 Console.WriteLine(drv[1].ToString());
20 }