Skip to content

Commit 0251558

Browse files
committed
Experimenting
1 parent 286b10a commit 0251558

File tree

3 files changed

+40
-0
lines changed

3 files changed

+40
-0
lines changed
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# Sample: Arrays of NRT
2+
3+
Samples for nullable arrays, arrays of nullables, and nullable arrays of nullables.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
-ms Rules -rt
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
class ArraysOfNullable
2+
{
3+
class A { }
4+
5+
void ArraysOfNullable()
6+
{
7+
A[] p_1 = new A[5]; // Array of non-nullable A all elements inited to null (oops)
8+
A[]? q_1 = null; // Nullable array of non-nullable A, array inited to null
9+
A?[] r_1 = new A[5]; // Array of nullable A all elements inited to null
10+
A?[]? s_1 = null; // Nullable array of nullable A, array inited to null
11+
12+
string[] p_2 = new string[5]; // Array of non-nullable string all elements inited to null (oops)
13+
string[]? q_2 = null; // Nullable array of non-nullable string, array inited to null
14+
string?[] r_2 = new string[5]; // Array of nullable string all elements inited to null
15+
string?[]? s_2 = null; // Nullable array of nullable string, array inited to null
16+
17+
int[] p_3 = new int[5]; // Array of non-nullable int all elements inited to 0
18+
int[]? q_3 = null; // Nullable array of non-nullable int, array inited to null
19+
int?[] r_3 = new int[5]; // Array of nullable int all elements inited to null
20+
int?[]? s_3 = null; // Nullable array of nullable int, array inited to null
21+
22+
dynamic[] p_4 = new dynamic[5]; // Array of non-nullable dynamic all elements inited to 0
23+
dynamic[]? q_4 = null; // Nullable array of non-nullable dynamic, array inited to null
24+
dynamic?[] r_4 = new dynamic[5]; // Array of nullable dynamic all elements inited to null
25+
dynamic?[]? s_4 = null; // Nullable array of nullable dynamic, array inited to null
26+
27+
A[][,] p_5 = new A[1][1,1]; // Array of two-dimensional array
28+
A[][,]? q_5 = null; // Array of two-dimensional array
29+
A[]?[,] r_5 = new A[]?[1,1]; // Two dimensional array of array
30+
A[]?[,]? s_5 = null; // Two dimensional array of array
31+
A?[][,] t_5 = new A[1][1,1]; // Array of two-dimensional array
32+
A?[][,]? u_5 = null; // Array of two-dimensional array
33+
A?[]?[,] v_5 = new A[]?[1,1]; // Two dimensional array of array
34+
A?[]?[,]? w_5 = null; // Two dimensional array of array
35+
}
36+
}

0 commit comments

Comments
 (0)