Wrox Programmer Forums
BOOK: Professional C# 4.0 and .NET 4
This is the forum to discuss the Wrox book Professional C# 4.0 and .NET 4 by Christian Nagel, Bill Evjen, Jay Glynn, Karli Watson, Morgan Skinner; ISBN: 9780470502259
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Professional C# 4.0 and .NET 4 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
Old November 1st, 2010, 02:18 AM
Authorized User
Join Date: Jul 2007
Posts: 17
Thanks: 0
Thanked 0 Times in 0 Posts
Default Chapter 5 - Creating Generic Classes

Question, chapter 5, page 110, Creating Generic Classes, the first code demonstrating non-generic class. In stepping through the code I understand creating the first LinkedListNode, and why First and Last point to the newNode.

In subsequent iterations when the line executes:

Last.Next = newNode;

both First.Next and Last.Next are updated to point to newNode. Then on the next two lines:

Last = newNode;
Last.Prev = previous;

when Last.Prev is updated, First.Prev is not updated. I'm not sure why this happens. Can anybody answer this?

I know during the first iteration that First and Last point to newNode. I'm assuming this has something to due with references. Not sure why Last = newNode, this breaks that reference and Last can be updated without affecting First.

Thanks, Mike

Similar Threads
Thread Thread Starter Forum Replies Last Post
.NET 2.0 article: Understanding Generic Classes jminatel .NET Framework 2.0 1 May 4th, 2007 07:30 AM
Excerpt: Understanding Generic Classes jminatel C# 2005 0 April 11th, 2006 08:12 PM
Creating classes!! NitinJoshi General .NET 2 January 24th, 2005 10:44 AM
Creating new objects from existing classes module0000 Beginning VB 6 3 June 17th, 2003 07:13 AM

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.