Cannot infer a data type for '<variablename>' because the array dimensions do not match
If the dimensions used to initialize an array do not match the dimensions in the declaration, the compiler cannot infer a data type for the array. For example, the following code causes this error.
' Valid. exampleArray1 is a one-dimensional array of integers.
Dim exampleArray1() = New Integer() {1, 2, 3}
' Not valid.
'Dim exampleArray2(,) = New Integer() {1, 2, 3}
'Dim exampleArray3(,) = New Integer() {}
Error ID: BC36909
Collaborate with us on GitHub
The source for this content can be found on GitHub, where you can also create and review issues and pull requests. For more information, see our contributor guide.
.NET feedback
.NET is an open source project. Select a link to provide feedback: