public static void Run() { Console.WriteLine("Testing array element type optimizations"); // We consider valuetype elements of arrays constructed... { Array arr = new NeverAllocated1[1]; ThrowIfNotPresent(typeof(TestArrayElementTypeOperations), nameof(Marker1)); // The reason they're considered constructed is runtime magic here // Make sure that works too. object o = arr.GetValue(0); if (!o.ToString().Contains(nameof(Marker1))) { throw new Exception(); } } // ...but not nullable... { Array arr = new Nullable <NeverAllocated2> [1]; arr.GetValue(0); ThrowIfPresent(typeof(TestArrayElementTypeOperations), nameof(Marker2)); } // ...or reference type element types { Array arr = new NeverAllocated3[1]; arr.GetValue(0); ThrowIfPresent(typeof(TestArrayElementTypeOperations), nameof(Marker3)); } }