Identifier expected, preceded with a period

A value from which a property name cannot be inferred has been included in the initializer list of an anonymous type declaration without being assigned to a property name.

' Not valid.
' Dim anon1 = New With {.grade = 100, 95}

Error ID: BC36576

To correct this error

  • Provide a property name for each value in the initializer list, as shown in the following code:

    Dim anon2 = New With {.grade1 = 100, .grade2 = 95}
    

See Also

Tasks

How to: Declare an Instance of an Anonymous Type

How to: Infer Property Names and Types in Anonymous Type Declarations

Concepts

Object Initializers: Named and Anonymous Types