This question already has an answer here:
- Call methods using names in C# 5 answers
For example:
Process[] processes = Process.GetProcesses();
string method = "Refresh";
foreach(Process p in processes)
{
p.Invoke(method); //I know there isn't a method named Invoke in the Process class
}
Is there a way I can invoke a method this way using reflection?
Aucun commentaire:
Enregistrer un commentaire