[Mono-list] Object Lookup with a Compound key
Dwivedi , Ajay Kumar
Wed, 19 Jun 2002 11:21:20 +0100
I need to store and retrieve objects with a compound key.
This is required for the SoapAttributeOverrides class. The class
stores SoapAttributes object for each Member of a class. So the
key to be used in the hashtable consists of Type of the class and
Name of the member.
Now I have 3 ways in which this can be implemented.
1. Make the key as 'Type.FullType+".."+MemberName' , with ".."
seperating Type and Member. This assumes that ".." can't occur
in the FullName or MemberName. This is the easiest, but I am
not sure if this is a language neutral approach.
2. Use a jagged 2D hashtable. The main hashtable is indexed by
Type and each value contains another hashtable which is
indexed by member names. However this approach might require
too many hashtables.
3. Use a new class which emcompasses the Type and MemberName and
use it as a key. This approach would however require creation
of a new key everytime a search is made.
I am confused over which approach to use.
Please give suggestions, or if possible a better approach.