Type inference converts your first call to
In<object>(x, p);
The parameters of this closed generic method are object, params object[]
.
Therefore, passing p
implicitly converts it to an object
, which becomes the single item in the params array.
Your second call is inferred (because of the first parameter) to
In<int>(x, p);
Here, the second parameter can either be an int[]
(passing an array directly) or a series of int
s (via params
).
Since IEnumerable<int>
is neither of those, you get an error.