p2p.wrox.com Forums

p2p.wrox.com Forums (http://p2p.wrox.com/index.php)
-   BOOK: Beginning Visual C# 2005 (http://p2p.wrox.com/forumdisplay.php?f=222)
-   -   Ch11CardLib InnerList.Contains vs List.Contains (http://p2p.wrox.com/showthread.php?t=64431)

jeroen1980 December 8th, 2007 09:25 AM

Ch11CardLib InnerList.Contains vs List.Contains
 
In the book on page 284 you add a new class, named Cards, to the Ch11CardLib. In the function Contains(Card card) you make use of the Contains method of the ArrayList for the collection accessed through the InnerList property. I've noticed that the List property also has a contains method. Is the InnerList.Contains just slightly more efficient than the List.Contains or is there another difference between the two?


peace95 December 8th, 2007 03:51 PM

My response is based solely on your question verbiage.
================================================== =====
I would not say one list is more efficient than the other, but rather both lists are equally efficient and important based on which list references the information needed. In other words, I look at the "CardLib" as a Card Catalogue, with the "List.Contains" as defining the Types of Cards/Subsections in the Card Catalogue, i.e. Birthday, Graduation, Holiday etc. Finally the "InnerList.Contains", the Arraylist, contains all the cards within the subsection within the card catalogue. The InnerList defines the granular level. You will be able to access the entire Card Catalogue or the catalogue by sections or a single card.

Hope this helps.

========================
Disclaimer: The above comments are solely the opinion of one person and not to be construed as a directive or an incentive to commit fraudulent acts.

jeroen1980 December 12th, 2007 07:50 AM

Sorry but this isn't making things any clearer. Do you mean that the List and the InnerList property both contain different values? The way I understand it is that both properties contain an identical list of references to some Card objects.
So what is practically the difference between adding or removing stuff to the List and InnerList property and will InnerList.Contains(cardref) and List.Contains(cardref) not always return the same value?

Thanks in advance.



All times are GMT -4. The time now is 10:53 AM.

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