在这个类中,我elp
在ElType
构造函数中设置。
我可以elp
在构造函数中访问正常的属性(该// ...
位是我访问elp
的属性的位置),但是当我尝试以elp
另一种方法访问时ucp()
- 我的程序因NullReferenceException
.
我无法弄清楚我在这里做错了什么,尽管这可能是非常简单的事情。
[Serializable]
public class ElBase : RectangleNode
{
public ElementParameters elp;
public ElBase(ElementParameters ElType)
{
this.elp = ElType;
// ...
}
private void ucp()
{
int i = 0;
if (this.elp.HasInput)
{
// ...
}
}