0

Is was wondering if there is no easier and robuster way to convert a static Method of a static class 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

Markus Weber
  • 1,059
  • 1
  • 11
  • 24

0 Answers0