我有一个包含以下列的数据表:
DataTable dt = new DataTable();
dt.Columns.Add("name",typeof(string));
dt.Columns.Add("Database",typeof(List<String>));
dt.Columns.Add("schedule", typeof(String));
dt.Columns.Add("Path",typeof(List<String>));
gridTask.DataSource = dt;
当我插入新行时,一切正常:
List<string> database = new List<string>(){"test1","test2","test3"};
List<string> path = new List<string>(){"test1","test2","test3"};
dt.Row.add((new object[] {"Test",database,"Test",path });
gridTask.DataSource = dt;
但是我想知道如何从List<String>
列中获取数据
答案 0 :(得分:2)
尝试
List<String> str = (List<String>)dt.Rows[x]["column"];