Hi
I have a class that inherits from Generics Dictionary
The string that is used for the key is passed thru-out my pgm and sometimes
it has modifiers added to the key string that are used in the system.
The problem is now I have to strip the modifer to lookup in the Dictionary
and I have to copy this code whenever I need to lookup the key or if more
modifers are added
Is there someway for me to override the way the Dictionary Lookups keys
so I can write the code to strip the modifer in one place so when I do a
ContainsKey
of this[sFileName][sKey] - if will look for key and if not found try to find
again after replace????
Thanks
if (this[sFileName].ContainsKey(sKey))
{
return (this[sFileName][sKey].Info);
}
else if (this[sFileName].ContainsKey(sKey.Replace("#","")))
{
return (this[sFileName][sKey.Replace("#","")]Info);
}
else if (this[sFileName].ContainsKey(sKey.Replace("^","")))
{
return (this[sFileName][sKey.Replace("^","")]Info);
}