Is there any way to know whether a procesure parameter is paramarr

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Using reflection, is there a way to know that a method or property parameter
is a paramarray? There doesn't seem to exist a property like 'IsParamArray'
in reflection.parameterinfo.

Thanks in advance.
 
Yes, check the ParamArrayAttribute:
....
ParameterInfo[] Param = callMethod.GetParameters();
for(int i = 0; i < Param.Length; i++)
{
if(Attribute.IsDefined(Param, typeof(System.ParamArrayAttribute)))
Debug.Write(Param.Name + " is a paramarray");
}
 
Back
Top