c# use readonly array as method default

50

c# use readonly array as method default -

private static readonly int[] FooDefault = new int[] { 5, 10 };
public void Foo(int[] x = null)
{
    x = x ?? FooDefault;
}

Comments

Submit
0 Comments