Επεξεργασία

Κοινοποίηση μέσω


BC36556: Anonymous type member name can be inferred only from a simple or qualified name with no arguments

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) }

See also