mercredi 4 février 2015

How do I get the signatures of all possible overloaded methods?

I would like to get an array of objects containing all possible overloaded method signatures for a method in a class. For example if we have:



public class SomeClass {
...
public void SomeMethod() { ... }
public void SomeMethod(int i) { ... }
public void SomeMethod(string s) { ... }
}


how can I find all possible parameter infos? I tried using:



MethodInfo method = type.GetMethod(methodName);
ParameterInfo[] possibleParameterInfos = method.GetParameters();
foreach (ParameterInfo possibleParameterInfo in possibleParameterInfos)
{
Console.WriteLine(possibleParameterInfo.ParameterType);
}


but I am not getting what I want.






Aucun commentaire:

Enregistrer un commentaire