日期:2014-05-17 浏览次数:20788 次
List<string> list = new List<string>();
list.AddRange(new string[] { "1", "2" });
DataTable dt = new DataTable();
dt.Columns.Add("X", typeof(int));
dt.Columns.Add("Y", typeof(string));
dt.Rows.Add(1, "1");
dt.Rows.Add(2, "2");
dt.Rows.Add(3, "3");
var result = from p in list.AsEnumerable()
from q in dt.AsEnumerable()
where p == q.Field<string>("Y")
select new { X = q.Field<int>("X"), Y = q.Field<string>("Y") };
result.ToList().ForEach(x => Console.WriteLine(x.ToString()));