jeudi 24 octobre 2019

How to call this function with reflection method,Parameters are delegates and generics

// this is code
    public class Foo1Parent
    {
    }
    public delegate void CallBack<T>(T arg1);
    public delegate void CallBack(); 
    public class Foo
    {
    public void openWindow<T>(CallBack<T> onWindowAwake) where T : Foo1Parent
     {
      Debug.Log("test");
      onWindowAwake(T);
     }
//I use reflection to call methods "openWindow"
public void openCWindow(CallBack onback, string dialogName)
{
    Type t = Assembly.GetExecutingAssembly().GetType(dialogName);
    MethodInfo meth1 = this.GetType().GetMethod("openWindow");
    object[] obj = new object[] { null }
    meth.Invoke(this, obj );
}
}


//this is my code


//this object[] How do you write it? or has other methods?




Aucun commentaire:

Enregistrer un commentaire