From: Tony Johansson on 16 Oct 2008 14:53 Hello! What actually does this sentence mean? Create a linked-list generic class that enables you to create a chain of different objects types. When I create a linked-list generic class for example with the string type. I do the following. List<string> myList = new List<string>(); So what can they mean when they say different objects types. Does it sounds reasonable that they mean a linked-list of object like this List<Object> myList = new List<Object>(); //Tony
From: Peter Duniho on 16 Oct 2008 15:11 On Thu, 16 Oct 2008 11:53:17 -0700, Tony Johansson <johansson.andersson(a)telia.com> wrote: > What actually does this sentence mean? > Create a linked-list generic class that enables you to create a chain of > different objects types. Impossible to say for sure without more context. > When I create a linked-list generic class for example with the string > type. > I do the following. > List<string> myList = new List<string>(); That's not a linked list. > So what can they mean when they say different objects types. > > Does it sounds reasonable that they mean a linked-list of object like > this > List<Object> myList = new List<Object>(); No. But perhaps they mean this: LinkedList<object> myList = new LinkedList<object>(); Pete
From: Tony Johansson on 16 Oct 2008 16:12 Hello! I just wonder what advantages does a LinkedList<T> have compared to List<T> ? So is it possible to say in general when to use LinkedList<T>? //Tony "Peter Duniho" <NpOeStPeAdM(a)nnowslpianmk.com> skrev i meddelandet news:op.ui4sx4k08jd0ej(a)petes-computer.local... > On Thu, 16 Oct 2008 11:53:17 -0700, Tony Johansson > <johansson.andersson(a)telia.com> wrote: > >> What actually does this sentence mean? >> Create a linked-list generic class that enables you to create a chain of >> different objects types. > > Impossible to say for sure without more context. > >> When I create a linked-list generic class for example with the string >> type. >> I do the following. >> List<string> myList = new List<string>(); > > That's not a linked list. > >> So what can they mean when they say different objects types. >> >> Does it sounds reasonable that they mean a linked-list of object like >> this >> List<Object> myList = new List<Object>(); > > No. But perhaps they mean this: > > LinkedList<object> myList = new LinkedList<object>(); > > Pete
From: Peter Duniho on 16 Oct 2008 16:40 On Thu, 16 Oct 2008 13:12:27 -0700, Tony Johansson <johansson.andersson(a)telia.com> wrote: > I just wonder what advantages does a LinkedList<T> have compared to > List<T> The primary advantage is that it's much faster (and simpler) to insert into or remove an element from a LinkedList<T> than into a List<T>, except for operations at the very end of the list. Those operations for a List<T> require the entire contents of the data structure after the point of modification to be copied, whereas for a LinkedList<T> those operations can always be completed in constant time, just by modifying a fixed number of pointers. > So is it possible to say in general when to use LinkedList<T>? LinkedList<T> has more overhead. So I would only use it when I expect to spend a lot of time modifying the list in ways other than adding or removing from the very end. Otherwise, List<T> is probably preferable. Pete
From: Arne Vajhøj on 16 Oct 2008 19:39 Tony Johansson wrote: > What actually does this sentence mean? > Create a linked-list generic class that enables you to create a chain of > different objects types. I think they want you to write your own LinkedList<> implementation. Arne
|
Pages: 1 Prev: Deserialization issue Next: Using C# to access TextToColumns in Excel Interop |