samedi 12 mars 2016

C# GetMethod Compile Time Save

Is there a way to do this:

var methodToDoStuffTo = typeof (FancyClass).GetMethod("MethodName").Name;

Without relaying on the string "MethodName"?

What I wan't is something like this:

var methodToDoStuffTo = typeof (FancyClass).GetMethod(FancyClass.MethodName).Name;

So I can be sure that there is no unexpected Error when I rename my Method MethodName.

Thank you!

Cheers,

Jan





Aucun commentaire:

Enregistrer un commentaire