Optional parameters require default values, but I cannot assign the default array to an optional array parameter. For instance:
Optional ByVal myArray As Long() = Nothing ' This works
However
Optional ByVal myArray As Long() = New Long() {0, 1} ' This isn't accepted.
The IDE states that New Long() {0, 1}a "constant expression" is required instead .
Is there a trick for assigning an array of constants by default, or is this not allowed?
source
share