public static partial class ArrayExtensions
public static T[]?[,] ToArrayOfNullable<T>(this T [,][] a) => a;
public static void Main()
Console.WriteLine("Environment version: {0} ({1}), {2}\n", System.Runtime.InteropServices.RuntimeInformation.FrameworkDescription , Environment.Version, Environment.OSVersion);
static void TestSolution2()
var nullableArray = (new string?[1,2][]).ToArrayOfNullable();
nullableArray[0, 0] = null;
nullableArray[0, 0] = new string? [] { null };
static void TestSolution1()
var f1 = ArrayExtensions.Create2D<string []>(1, 1);
f1[0, 0] = new string [] { null };
var f2 = ArrayExtensions.Create2D<string? []>(1, 1);
f2[0, 0] = new string? [] { null };
var f3 = ArrayExtensions.Create2D<string? []?>(1, 1);
f3[0, 0] = new string? [] { null };
string ?[]?[,] f4 = ArrayExtensions.Create2D<string []?>(1, 1);
f4[0, 0] = new string? [] { null };
f4[0, 0] = new string [] { "" };
Console.WriteLine(f3.GetType() == f1.GetType());
string? [][][] a = new string? [][][] { new string? [][] { new string? [] { null } } };
string? [,][] b = new string? [,][] { { new string? [] { null } } };
public static partial class ArrayExtensions
public static T[,] Create2D<T>(int count1, int count2) => new T[count1, count2];