I have the following method:
void MyMethod(params object[] args)
{
}
which I am trying to call with a type parameter object[]:
object[] myArgs = GetArgs();
MyMethod(myArgs);
It compiles fine, but inside MyMethodI args == { myArgs}, that is, an array with one element, which are my original arguments. Obviously, I wanted to have args = myArgswhat I'm doing wrong?
EDIT:
John Skeet was actually right, GetArgs()made a wrapper in an array of one element, sorry for the stupid question.
source
share