public class SomeClass
{
public SomeClass(SomeType[] elements)
{
}
public SomeClass(params SomeType[] elements)
{
}
}
I printed this code and got CS0111 error. I'm surprised, are SomeType[] elements and params SomeType[] elements the same arguments?
The difference between the two is that one requires a single concrete array, while the other also allows it to be called with individual items such as
Choose the
paramsone if you need to call it as above and delete the other.Why?
The error speaks to the fact that both are, to the compiler, the same signature
SomeType[]hence the error.