【发布时间】:2011-02-21 10:45:24
【问题描述】:
为什么下面的 C# 不合法?是否存在适当的解决方法?
public class Base
{
public Base(Func<double> func) { }
}
public class Derived : Base
{
public Derived() : base(() => Method()) <-- compiler: Cannot access non-static method 'Method' in static context
{
}
public double Method() { return 1.0; }
}
【问题讨论】: