Taken from http://www.galcho.com/Blog/P…
Here is how to call a method with an out parameter using MethodInfo.Invoke, in this case the out parameter is the last one (int).
int parNum = 0;
string parText = “99″;
object[] methodParms = new object[] { parText, parNum };
MethodInfo methInfo = parNum.GetType().GetMethod(“TryParse”, new Type[] { typeof(string), typeof(int).MakeByRefType() });
methInfo.Invoke(null, methodParms);
parNum = (int)methodParms[1];
Console.WriteLine(“Parsed number:{0}”, parNum);
Say you have an outer method:
public OuterMethod(object x)
{
InnerMethod(x);
}
and an inner method with these overloads
public InnerMethod(object x)
{
//Generic Actions
}
public InnerMethod(Person x)
{
//Person Specific Actions
}
public InnerMethod(Dog x)
{
// Dog Specific Actions
}
How do you make it so that when the outer method calls the inner method it completes the specific actions as well as the generic ones that allows you to [...]