Assembly: System.Xml (in system.xml.dll)
Public Property ElementName As String
Dim instance As XmlElementAttribute Dim value As String value = instance.ElementName instance.ElementName = value
public string ElementName { get; set; }
public: property String^ ElementName { String^ get (); void set (String^ value); }
/** @property */ public String get_ElementName () /** @property */ public void set_ElementName (String value)
public function get ElementName () : String public function set ElementName (value : String)
Valore proprietà
Il nome dell'elemento XML generato. Il valore predefinito è l'identificatore del membro.Specificare un ElementName se si desidera che il nome dell'elemento XML generato sia diverso dall'identificatore del membro.
È possibile impostare lo stesso valore ElementName su più di un membro di classe a condizione che il documento XML generato utilizzi gli spazi dei nomi XML per distinguere tra membri con nome uguale. Per ulteriori dettagli sull'utilizzo degli spazi dei nomi e dei nomi con prefisso nel documento XML, vedere la classe XmlSerializerNamespaces.
Nell'esempio seguente viene impostata la proprietà ElementName di un XmlElementAttribute su un nuovo valore.
' This is the class that will be serialized. Public Class XClass ' The XML element name will be XName ' instead of the default ClassName. <XmlElement(ElementName := "XName")> Public ClassName() As String End Class
// This is the class that will be serialized. public class XClass { /* The XML element name will be XName instead of the default ClassName. */ [XmlElement(ElementName = "XName")] public string ClassName; }
// This is the class that will be serialized. public ref class XClass { public: /* The XML element name will be XName instead of the default ClassName. */ [XmlElement(ElementName="XName")] String^ ClassName; };
// This is the class that will be serialized.
public class XClass
{
/* The XML element name will be XName
instead of the default ClassName. */
/** @attribute XmlElement(ElementName = "XName")
*/
public String className;
} //XClass
Windows 98, Windows 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile per Pocket PC, Windows Mobile per Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
.NET Framework non supporta tutte le versioni di ciascuna piattaforma. Per un elenco delle versioni supportate, vedere Requisiti di sistema.