Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
You cannot infer an anonymous type member name from a complex expression.
Error ID: BC36556
Example
The following example generates BC36556:
Dim numbers() As Integer = { 1, 2, 3, 4, 5 }
Dim instanceName = New With {numbers(3)}
For more information about sources from which anonymous types can and cannot infer member names and types, see How to: Infer Property Names and Types in Anonymous Type Declarations.
To correct this error
Assign the expression to a member name, as shown in the following code:
Dim numbers() As Integer = { 1, 2, 3, 4, 5 }
Dim instanceName = New With { .number = numbers(3) }