I have a dictionary object I'm working on that can take keys of either of two types: string or System.Type. Currently I have TKey set as object, and then explicitly check the type. Is there a better way to handle this?
as an example, in the below code, I want to ...
replace IDictionary<object,IDataTranslator> with IDictionary<string or Type,IDataTranslator>
replace the two internal dictionary with one, that is only string/Type - that way I don't have to do any redundant type checking?
//stores data for specialized/default translations between types/strings
//IDataTranslator is a custom interface used in the library
public class translators : IDictionary<object,IDataTranslator>
//holds the string-based translators
protected Dictionary<string,IDataTranslator> m_translators_s;
//holds the dictionary based translators.
protected Dictionary<Type,IDataTranslator> m_translators_t;
View Complete Post