我正在使用WCF REST Preview 2来测试一些REST服务。 ?包装上有一个扩展的IEnumerable为ToDictionary(Func键(TSource,TKEY的)keySelctor不知道如何定义lambda函数返回的KeySelectorsWCF REST扩展到IEnumerable Lambda Func <TSource,TKey> keySelector
下面是一个例子:
var items = from x in entity.Instances // a customized Entity class with list instances of MyClass
select new { x.Name, x};
Dictionary<string, MyClass> dic = items.ToDictionary<string, MyClass>(
(x, y) => ... // what should be here. I tried x.Name, x all not working
不知道应该怎样?将拉姆达函数功能应该是返回一个KeySelector
谢谢。有用。 – 2009-08-27 22:20:15