【发布时间】:2011-07-19 20:09:43
【问题描述】:
我将所有高级功能都整合到了这一项中,但我并没有非常多地使用泛型或 lambda 表达式:
这是我要创建的方法的示例用法:
MyClass mc = null;
int x = mc.TryGetOrDefault(z => z.This.That.TheOther); // z is a reference to mc
// the code has not failed at this point and the value of x is 0 (int's default)
// had mc and all of the properties expressed in the lambda expression been initialized
// x would be equal to mc.This.That.TheOther's value
据我所知,但 Visual Studio 抱怨:
【问题讨论】:
标签: c# generics lambda extension-methods