Answer: Yes it can. Suppose let us take an example of
void paramsMyDemo(object arg1, object arg2, params object[] argsResult)
{
foreach (object arg in argsResult)
{
/* Some Logic */
}
}
Here params keyword is applied on a method parameter which is an array . So now if we want to invoke that method we need to pass the parameters in comma seperated list.
type.paramsMyDemo(2,0.5f, "DotNetFunda", 0.0m, new UserDefinedType());
Asked In: Many Interviews |
Alert Moderator