I get an InvalidCastException with the following code:
As well as
Although I this works perfectly fine:
I'm aware that one is 1-D and the other is 2-D, but how can I create a one-dimensional array of Integer with the lower bound 1?
It seems impossible!!
FYI: This is VB.NET with .NET Framework 2.0.
VB.NET:
Dim arr() As Integer = DirectCast(System.Array.CreateInstance(GetType(Integer), New Integer() {10}, New Integer() {1}), Integer())
VB.NET:
Dim arr() As Integer = CType(System.Array.CreateInstance(GetType(Integer), New Integer() {10}, New Integer() {1}), Integer())
Although I this works perfectly fine:
VB.NET:
Dim arr(,) As Integer = DirectCast(System.Array.CreateInstance(GetType(Integer), New Integer() {10, 10}, New Integer() {1, 1}), Integer(,))
I'm aware that one is 1-D and the other is 2-D, but how can I create a one-dimensional array of Integer with the lower bound 1?
It seems impossible!!
FYI: This is VB.NET with .NET Framework 2.0.
Last edited: