Thursday, 8 August 2013

C# - Determining the number of parameters accepted by a method

C# - Determining the number of parameters accepted by a method

Is it possible to get the number of parameters accepted by a method and
then access the values of these parameters individually? I want to create
a method which concatenates the values of all the parameters of a method,
except the last parameter. However, the number of parameters and the name
of the parameters depend on the method being accessed.
Is it possible to do something similar to the following pseudo-code?
StringBuilder string = new StringBuilder();
for(int i = 0; i < Method.Parameters.Count - 1; i++)
{
string.Append(Method.Parameters[i].Value);
}
Thank you very much :)

No comments:

Post a Comment