mercredi 10 juin 2015

how can call all method dynamic in c#?

i have a class , and in this class i have many method and i wanna call all method with out write name

this is my code and it work :

System.Reflection.MethodInfo[] methods = typeof(content).GetMethods(System.Reflection.BindingFlags.Public | System.Reflection.BindingFlags.Static);
        foreach (System.Reflection.MethodInfo m in methods)
        {
            Response.Write(typeof(content).GetMethod(m.Name).Invoke(null,null).ToString());
}

but i have one problem ,that code return just first method name

What should I do to get all of them? what's wrong ?





Aucun commentaire:

Enregistrer un commentaire