Multiple initializations of '<membername>'

Multiple initializations of '<membername>'. Fields and properties can be initialized only once in an object initializer expression.

You can assign an initial value to each field and property in an object initializer list only one time. The following declaration is not valid.

' Dim cust = New Customer() With {.Name = "Bob", .Name = "Robert"}

Note

You can use one field or property as the initial value for another member, as shown in the following declaration.

Dim cust = New Customer() With {.First = "Mike", .Last = "Nash", _
                                .Full = .First & " " & .Last}

Error ID: BC30989

To correct this error

  • Eliminate all except one of the initializations for each field or property in the object initializer list.

See Also

Concepts

Object Initializers: Named and Anonymous Types

Property Procedures vs. Fields