True, but it's a VERY, VERY bad idea to use an ArrayList when you have
the typed information, since it is not type-safe.
Also, an ArrayList isn't the best bet here, depending on the nature of
the keys. If you have a tremendous number of keys, and ArrayList is a bad
choice since you will have to iterate through the list to perform a lookup,
which could have a perf impact.
--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)
cp said:
Ron,
Why not just use a boolean value of "true", or use null. That's what
I
do when I need this functionality.
If I had to guess, I would say you are looking for a way to prevent
duplicates.
Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)
Hi group,
I need similar functionality I'm getting from the hashtable, but
without
the value .all I need is keys. this of course negates the need for
"hashing", but I wanted to know if there's a class for that in C#.
I need to:
- Set keys
- look for the existence of keys
- remove keys.
anything for this purpose?
- Ron
there are 3 types of collections in .net, ordered (stack/queue),
indexed (arraylist) and keyed (hashtable).
the indexed collections are based on an IList whereas the keyed ones
are based on an IDictionary. the ordered ones are based on ICollection.
aside from using arraylist directly you could also create your own
class and implement the ilist members - that would give you a type-safe
version for your keys. arraylist would let you pretty much add whatever
you like!
cp