c# 'params' keyword

The 'params' keyword.

Basically 'params' has the runtime encapsulate the parameters in an array when passed to the method, so:

void main()
{
foo(1,2,3);
bar(new int[]{1,2,3});
}

void foo (params int[] i){}

void bar (int[] i){}

Can be treated similarly.





It must be placed at the end of a list of method parameters

Comments

Popular posts from this blog

Distance between two gps coordinates?