Diccionario <T, Delegado> con Delegados de diferentes tipos: ¿Limpiador, nombres de métodos sin cadenas?
Tiene que haber un método más limpio. Actualmente tengo:
... Constructor()
{
parseDictionary = new Dictionary<typeOfStream, Delegate>()
{
{typeOfStream.SOME_ENUM_VAL, Delegate.CreateDelegate(typeof(ParseDelegate<string>), this, "MyMethod")},
{typeOfStream.SOME_OTHER_ENUM_VAL, Delegate.CreateDelegate(typeof(ParseDelegate<XmlNode>), this, "MyOtherMethod")}
};
}
public bool MyMethod(string some_string)
{
...
}
public bool MyOtherMethod(XmlNode some_node)
{
...
}
y me gustaría deshacerme de"MyMethod" yMyOtherMethod y hazlothis.MyMethod ythis.MyOtherMethod. Opciones?
Estoy abierto a cualquier solución que me permita usar una búsqueda en el Diccionario y apuntar mi mojo de datos a un método arbitrario (un método bien definido con un conjunto arbitrario de argumentos) para analizar.