Anonymous type member property '<propertyname>' cannot be used to infer the type of another member property because the type of '<propertyname>' is not yet established

Until the type of an anonymous type property is established, it cannot be used to establish the type of another property. For example, in the following declaration .IDName = .LastName is not valid because .LastName has not yet been initialized.

' Not valid. 
' Dim anon1 = New With {Key .IDName = .LastName, Key .LastName = "Jones"} 

Error ID: BC36559

To correct this error

  • Establish the type of the property before using it to initialize another property.

    Dim anon2 = New With {Key .LastName = "Jones", Key .IDName = .LastName}
    

See Also

Tasks

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

Concepts

Anonymous Types