Answers for "c# use readonly array as method default"

C#
0

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;
}
Posted by: Guest on September-29-2021

C# Answers by Framework

Browse Popular Code Answers by Language