This question already has an answer here:
Is was wondering if there is no easier and robuster way to convert a Method into a MethodInfo
than writing
typeof(MyStaticClass).GetMethod("MyStaticMethod")
My aim is to write a Dictionary<Type, MethodInfo>
where i can map a Type
to a Method.
MethodDictionary[typeof(bool)].Invoke(null, new object[] {});
I know that in C# 6 there is the possibility to write
typeof(MyStaticClass).GetMethod(nameof(MyStaticMethod))
But i'd like to stick to C# 5
Aucun commentaire:
Enregistrer un commentaire