Unsorted List

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Is there a structure in which I can store name/value pairs that does not
re-order the items? I think I am looking for the equivilant of a Java
MapList.
 
Steve C. Orr said:

As far as I can tell an ArrayList supports single item entries, not
name/value pairs? Am I missing something? It wouldn't be the first time.
If that doesn't suit your needs, there are a variety of collections for you
to choose from, and they are all listed here:
http://msdn.microsoft.com/library/en-us/cpref/html/frlrfSystemCollections.asp?frame=true

Yeah, I have been through these. SortedList and Hashtable both stored
name/value pairs -- or key/value as they write there -- but both reorder the
data entered. DictionaryBase supports pairs, but I can't tell from the docs
if it forces sorting. It also looks like you have to inherit and write a
bunch of methods to use it.
 
Oh, I think I see what you mean now.
The VB.NET collection class is the best of both worlds and it should solve
your problem.
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vblr7/html/vaobjcollectionpme.asp
This class is one of the many little reasons why VB.NET is better than C#.
;-)

Don't worry, if you're using C# you can always import the visual basic
namespace and use it anyway.

--
I hope this helps,
Steve C. Orr, MCSD, MVP
http://SteveOrr.net





John Bankhead said:
Steve C. Orr said:

As far as I can tell an ArrayList supports single item entries, not
name/value pairs? Am I missing something? It wouldn't be the first time.
If that doesn't suit your needs, there are a variety of collections for
you
to choose from, and they are all listed here:
http://msdn.microsoft.com/library/en-us/cpref/html/frlrfSystemCollections.asp?frame=true

Yeah, I have been through these. SortedList and Hashtable both stored
name/value pairs -- or key/value as they write there -- but both reorder
the
data entered. DictionaryBase supports pairs, but I can't tell from the
docs
if it forces sorting. It also looks like you have to inherit and write a
bunch of methods to use it.
 
Back
Top