A variable of type Product?[] denotes an array that can contain Product or null values but that won’t be null itself:
Product?[] arr1 = new Product?[] { p1, p2, null }; // OK
Product?[] arr2 = null; // Not OK
A variable of type Product[]? is an array that can hold only Product values and not null values, but the array itself may be null:
Product[]? arr1 = new Product[]? { p1, p2, null }; // Not OK
Product[]? arr2 = null; // OK
A variable of type Product?[]? is an array that can contain Product or null values and that can itself be null:
Product?[]? arr1 = new Product?[] {p1, p2, null }; // OK
Product?[]? arr2 = null; // Also OK
No comments:
Post a Comment