michael michael - 3 months ago 8
C# Question

C# - Is it possible to have null params?

public void Foo(params string[] values)
{
}


Is it possible that
values
can ever be
null
, or will it always be set with
0
or more items?

Answer

Absolutely - you can call it with an argument of type string[] with a value of null:

string[] array = null;
Foo(array);