Quote:
Originally Posted by amigo1
Q1 ] How does the internal keyword work here?
Q2] How to make use of the Prev property?
Q3] In this statement :
public object Value { get; private set; }
why the type is âobjectâ instead of â LinkedListNode â
Q4] Should we remember such programs ?
Q5] Is there any class called âLinkedListâ ? I know there is a class called âLinkedList<T>â , so that the transition to such a class (âLinkedList<T>â ) in the next section of the chapter would create a system class overlap , --- actually If you may please explain this area
|
That many questions ;-)
Q1: internal works here the same as on other places. Using internal with the set accessor of the property, only code within the assembly is allowed to access this property accessor.
Q2: Do you mean this?
Code:
var node = myLinkedList.Prev;
Q3: Because the Value property is used to access the object that is kept with the LinkedListNode.
Q4: why not? Of course it's better to use generic types instead of object types, but I guess this sample leads you in that way and makes a comparision later on.
Q5: There is a LinkedList<T>, as you know already. There is no overlap as one type is non-generic, and the other one is generic, and they are also in different namespaces. Of course as there is a LinkedList<T> class in the Framework there's no need to create a custom one. However, it's good to know how this works to build something similar, and to know what's behind the LinkedList<T> class.