list转Dictionary
时间:2014-04-29 10:18:46
收藏:0
阅读:339
Dictionary<Guid, int> dic = lst.ToDictionary(new Func<Test, Guid>(c => c.Id), new Func<Test, int>(c => c.Num));
//如果觉得上面的写法太复杂,还可以简化为
// Dictionary<Guid, int> dic = lst.ToDictionary(c =>
c.Id, c => c.Num);
评论(0)