Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

Xolution

C# Properties Problem

This topic is 5837 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

The code speaks for itself...
  
    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.

  
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]

Share this post


Link to post
Share on other sites
Advertisement
Ah, no worries now.
I had my set part like

set {
this._next = Next;
}

Changed it to value, now it all seems to work...

Share this post


Link to post
Share on other sites
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

}

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!