I think calling it "hiding" is misleading here, to be honest.
Both methods are definitely created, but if you call:
Concat(5);
then for that invocation both methods are applicable (in the terminology of the C# spec section 7.5.3.1) but the first method is better (section 7.5.3.2) because of this:
- Otherwise, if MP is applicable in its normal form and MQ has a
params
array and is applicable only in its expanded form, then MP is better than MQ.
So in that case, the first method would be called.
The second method cannot be called using params
expansion without specifying at least one string. It can still be called with an empty array, of course:
Concat(5, new string[0]);