Edit

Share via


'{' expected

To declare an instance of a named or anonymous type by using an object initializer, you must enclose the list of fields or properties and their initial values in braces ({ and }).

VB
Dim client As New Customer() With {.Name = "Microsoft", .City = "Seattle"}  
Dim emp = New Employee() With {.Name = "Rob Young", .ID = 55555}  
Dim anon = New With {.ID = 123456}  

Error ID: BC30987

To correct this error

  • Include an initialization list after With, enclosed in braces.

See also