'<membername>' is not a member of '<contextname>'; it does not exist in the current context

A non-existent member name has been assigned to a property in an anonymous type declaration. In the following example, .Prop1 and .Prop2 are the properties of the anonymous type. The attempt to assign .Prop3 to .Prop2 causes the error.

' Not valid.
Dim anon1 = New With {.Prop1 = 27, .Prop2 = .Prop3}

' The assignment is valid if the assigned property has been declared 
' and initialized.
Dim anon2 = New With {.Prop1 = 27, .Prop2 = .Prop1}

Error ID: BC36657

To correct this error

  • Examine your code to determine what you want to assign. The variable name might be misspelled, or it might require qualification if it is a property of another object.

See Also

Tasks

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

Concepts

Anonymous Types