Hello, I wanna find something like linked list but non from generic namespace, is it possible ? Thanks.
A:
ArrayList is more or less a linked list and is not generic. You can also expose it as IEnumerable (and not IEnumerable) which is in fact the linkedlist interface in terms of iteration.
Aliostad
2010-09-06 21:19:52
It isn't really much like a linked list in terms of the performance profile for operations like insert/remove. `ArrayList` maps to `List<T>` only...
Marc Gravell
2010-09-06 21:22:34
I need functionality from LinkedList for example native order and other, I cannot use ArrayList.
jitm
2010-09-06 21:22:45
@jitm, about the only way that a linked list is like an array list, is maintaining insertion order.
Jon Hanna
2010-09-07 02:45:21
+2
A:
Since you are using .NET 1.x, you would need to either implement this from scratch (which isn't that hard really), or settle for ArrayList
. I know the position - for a utility library I ended up writing the list primitives from scratch, because:
- 1.x lacks the generic versions
- Silverlight lacks the non-generic versions
so to work on all platforms, I rolled my own (I had other unique features too, which made hacking around with something like a using
alias undesirable - such as thread-safe tail-iteration while appending items).
Marc Gravell
2010-09-06 21:25:16
@jitm - of a linked list? Most text-book examples would suffice (translated to C#, obviously). My *specific* ones weren't linked list, else you would be more than welcome to them.
Marc Gravell
2010-09-06 21:30:28