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.
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