Proprietà o membro di tipo anonimo '<nomeproprietà>' già dichiarato

Aggiornamento: novembre 2007

Anonymous type member or property '<propertyname>' is already declared

Un nome di proprietà può essere dichiarato una sola volta nella dichiarazione di un tipo anonimo. Ad esempio, le seguenti dichiarazioni non sono valide:

'' Not valid, because the Label property is assigned to twice.
' Dim anonType1 = New With {.Label = "Debra Garcia", .Label = .Label & ", President"}
'' Not valid, because the property name inferred for both properties is
'' Name.
' Dim anonType2 = New With {Key product.Name, Key car1.Name}

ID errore: BC36547

Per correggere l'errore

  • Scegliere un nome diverso per una delle proprietà.

    ' Valid.
    Dim anonType3 = New With {.Name = "Debra Garcia", .Label = .Name & ", President"}
    
  • Fornire nomi nuovi per le variabili o nomi di proprietà da cui si stanno inferendo nomi e valori.

    ' Valid.
    Dim anonType4 = New With {Key .ProductName = product.Name, Key .CarName = car1.Name} 
    

Vedere anche

Attività

Procedura: dedurre nomi di proprietà e tipi nelle dichiarazioni di tipo anonimo

Concetti

Tipi anonimi