Skip to content

Commit 667e302

Browse files
authored
Escape asterisk in Array.CreateInstance (#4159)
1 parent 1ecb9c3 commit 667e302

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

xml/System/Array.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2542,7 +2542,7 @@
25422542
This method is an O(`n`) operation, where `n` is the product of all values in `lengths`.
25432543

25442544
> [!NOTE]
2545-
> Not all languages support arrays with non-zero lower bounds, and therefore you may not be able to cast instances of non-zero based <xref:System.Array> to the language's array type. For example, you cannot cast a 1-dimensional integer array with the lower bound 6 to C#'s `int[]` type. This results in <xref:System.InvalidCastException> during runtime with the message "Unable to cast object of type 'System.Int32[*]' to type 'System.Int32[]'.", where the asterisk (*) means non-zero based index. However, you can cast zero based arrays of any rank created with <xref:System.Array.CreateInstance(System.Type,System.Int32[],System.Int32[])> to the language's array. For example, you can cast a 2-dimensional zero based integer array created with this method to C#'s `int[,]` type.
2545+
> Not all languages support arrays with non-zero lower bounds, and therefore you may not be able to cast instances of non-zero based <xref:System.Array> to the language's array type. For example, you cannot cast a 1-dimensional integer array with the lower bound 6 to C#'s `int[]` type. This results in <xref:System.InvalidCastException> during runtime with the message "Unable to cast object of type 'System.Int32[\*]' to type 'System.Int32[]'.", where the asterisk (\*) means non-zero based index. However, you can cast zero based arrays of any rank created with <xref:System.Array.CreateInstance(System.Type,System.Int32[],System.Int32[])> to the language's array. For example, you can cast a 2-dimensional zero based integer array created with this method to C#'s `int[,]` type.
25462546

25472547
## Examples
25482548
The following code example shows how to create and initialize a multidimensional <xref:System.Array> with specified lower bounds.

0 commit comments

Comments
 (0)