Impossibile selezionare attributi XML dal tipo 'type'

Aggiornamento: novembre 2007

XML attributes cannot be selected from type 'type'

È stato fatto riferimento a un attributo XML per un oggetto che non è di tipo XElement o IEnumerable(Of XElement). Per ulteriori informazioni, vedere Proprietà axis attributo XML.

' Generates an error.
Dim var = "sample text".@attr

ID errore: BC36808

Per correggere l'errore

  • Assicurarsi che l'oggetto a un attributo del quale si sta facendo riferimento sia fortemente tipizzato come XElement o IEnumerable(Of XElement). Di seguito è riportato un esempio:

    Dim elem As XElement = <root attr="value"/>
    Dim var = elem.@attr
    

Vedere anche

Riferimenti

Proprietà axis attributo XML

Altre risorse

Proprietà Axis XML

XML in Visual Basic