P
pamela fluente
In a previous question I asked if there were collections
similar to SortedList or Dictionary which would hold KEYS only, No
values.
It seems that the framework does not have such "reduced" collections,
but one can use
the standard one, adding as value a Null/Nothing value or a boolean
(of creating a collection
by inheritance).
I am wondering what is most advisable to use as type for the values:
Boolean or Object ?
For instance:
C#
SortedList<MyKey, bool> MyListB = new SortedList<MyKey, bool>();
MyListB.add(new MyKey(), false);
or
SortedList<MyKey, object> MyListO = new SortedList<MyKey, object>();
MyListO.add(new MyKey(), null);
VB
dim MyListB as new SortedList(of MyKey, Boolean)
MyListB.add(New MyKey, false)
or
dim MyListO as new SortedList(of MyKey, Object)
MyListO.add(New MyKey, Nothing)
I am wondering if using a value type (boolean) instead of a reference
type
would be more inefficient ? Your opinion ?
-P
similar to SortedList or Dictionary which would hold KEYS only, No
values.
It seems that the framework does not have such "reduced" collections,
but one can use
the standard one, adding as value a Null/Nothing value or a boolean
(of creating a collection
by inheritance).
I am wondering what is most advisable to use as type for the values:
Boolean or Object ?
For instance:
C#
SortedList<MyKey, bool> MyListB = new SortedList<MyKey, bool>();
MyListB.add(new MyKey(), false);
or
SortedList<MyKey, object> MyListO = new SortedList<MyKey, object>();
MyListO.add(new MyKey(), null);
VB
dim MyListB as new SortedList(of MyKey, Boolean)
MyListB.add(New MyKey, false)
or
dim MyListO as new SortedList(of MyKey, Object)
MyListO.add(New MyKey, Nothing)
I am wondering if using a value type (boolean) instead of a reference
type
would be more inefficient ? Your opinion ?
-P