假设我有类作为我执行代码的一部分:
public class DataAccess
{
//class definition...
}
我在课堂上有一个补充:
public class Tender
{
public DataAccess DataAccess { get; set; }
//other members and class definition
}
好吧,我的问题是我有一个消耗(也添加)类,如下所示:
public class TenderProcessor
{
public void Process(Tender tender)
{
//having line below uncommented throws the following exception when
//this(Process) method is called:
//Method not found: 'namespace.DataAccess namespace.Tender.get_DataAccess()'
this.DoSomething(tender.DataAccess, otherParametersEtc);
}
}
如果this.DoSomething(tender.DataAccess, otherParametersEtc)
没有注释,我会得到Method not found Exception
,但是如果我注释掉该行,我实际上可以进入 Process 方法,将鼠标悬停在tender
对象上并查看DataAccess
完全正常的值。
有人可以解释发生了什么吗?