ListNode ln1 = new ListNode("1");
ListNode ln2 = new ListNode("2");
ln1.Next = ln2;
Console.WriteLine(ln1.Content);
Console.WriteLine(ln2.Content);
Console.WriteLine(ln1.Next.Content); // Dies here.
C# Properties Problem
The code speaks for itself...
Content is a string property of ListNode, Next is a ListNode property of ListNode (next node in the list). Any ideas?
[edited by - Xolution on June 30, 2002 7:43:28 PM]
What the code for the Next property look like? What about other (relevant) bits of ListNode? I assume you wrote ListNode yourself...
codeka.com - Just click it.
codeka.com - Just click it.
Ah, no worries now.
I had my set part like
set {
this._next = Next;
}
Changed it to value, now it all seems to work...
I had my set part like
set {
this._next = Next;
}
Changed it to value, now it all seems to work...
I think Eric Gunnerson mentioned something about making that a compiler error - at least this variant:
public SomeType SomeThing{ get{ return SomeThing; } //instead of someThing - the private instance variable}
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement