In this class, I am setting elp
to ElType
in the constructor.
I can access properties of elp
fine when in the constructor (the // ...
bit is where I'm accessing elp
's properties), but when I try to access elp
in another method - ucp()
- my program crashes with NullReferenceException
.
I can't figure out what I'm doing wrong here, although it would probably be something pretty straight forward.
[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)
{
// ...
}
}