c# use readonly array as method default

53

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