samedi 27 février 2016

Invoke an static delegate from Reflection?

I have the folow line:

public static class Foo
{
    public static Func<object,string> Bar = myObject => myObject.ToString();
}

There is no way to perform something like Bar(someObject); using reflection in C#. As I can see Bar is not a Method, is a Field, of course, and I can't use MethodInfo.Invoke();





Aucun commentaire:

Enregistrer un commentaire