XmlTypeAttribute.TypeName-Eigenschaft
Ruft den Namen des XML-Typs ab oder legt diesen fest.
Namespace: System.Xml.Serialization
Assembly: System.Xml (in system.xml.dll)
Syntax
'Declaration
Public Property TypeName As String
'Usage
Dim instance As XmlTypeAttribute
Dim value As String
value = instance.TypeName
instance.TypeName = value
public string TypeName { get; set; }
public:
property String^ TypeName {
String^ get ();
void set (String^ value);
}
/** @property */
public String get_TypeName ()
/** @property */
public void set_TypeName (String value)
public function get TypeName () : String
public function set TypeName (value : String)
Eigenschaftenwert
Der Name des XML-Typs.
Hinweise
XmlTypeAttribute wird auf eine Klasse angewendet, um den Namespace und Namen des XML-Typs anzugeben und festzulegen, ob der Typ in das XML-Schemadokument aufgenommen werden soll. Um nach dem Festlegen der Eigenschaften der XmlTypeAttribute-Klasse das Ergebnis anzuzeigen, kompilieren Sie die Anwendung als ausführbare Datei oder als DLL, und übergeben Sie die so entstandene Datei an XML Schema Definition-Tool (Xsd.exe). Das Tool erstellt das Schema einschließlich der Typdefinition.
Beispiel
Im folgenden Beispiel wird XmlTypeAttribute der Person-Klasse und auf die Job-Klasse angewendet. Wenn Klasse kompiliert wird und die so entstandene ausführbare Datei an das XML Schema Definition-Tool übergeben wird, wird das Schema im Abschnitt Ausgabe angezeigt.
Public Class Group
Public Staff() As Person
End Class
<XmlType(TypeName := "Employee", _
Namespace := "http://www.cpandl.com")> _
Public Class Person
Public PersonName As String
Public Position As Job
End Class
<XmlType(TypeName := "Occupation", _
Namespace := "http://www.cohowinery.com")> _
Public Class Job
Public JobName As String
End Class
public class Group {
public Person[]Staff;
}
[XmlType(TypeName = "Employee",
Namespace = "http://www.cpandl.com")]
public class Person {
public string PersonName;
public Job Position;
}
[XmlType(TypeName = "Occupation",
Namespace = "http://www.cohowinery.com")]
public class Job {
public string JobName;
}
ref class Person;
ref class Job;
ref class Group
{
public:
array<Person^>^Staff;
};
[XmlType(TypeName="Employee",
Namespace="http://www.cpandl.com")]
public ref class Person
{
public:
String^ PersonName;
Job^ Position;
};
[XmlType(TypeName="Occupation",
Namespace="http://www.cohowinery.com")]
public ref class Job
{
public:
String^ JobName;
};
public class Group
{
public Person staff[];
} //Group
/** @attribute XmlType(TypeName = "Employee",
Namespace = "http://www.cpandl.com")
*/
public class Person
{
public String personName;
public Job position;
} //Person
/** @attribute XmlType(TypeName = "Occupation",
Namespace = "http://www.cohowinery.com")
*/
public class Job
{
public String jobName;
} //Job
Plattformen
Windows 98, Windows 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile für Pocket PC, Windows Mobile für Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
.NET Framework unterstützt nicht alle Versionen sämtlicher Plattformen. Eine Liste der unterstützten Versionen finden Sie unter Systemanforderungen.
Versionsinformationen
.NET Framework
Unterstützt in: 2.0, 1.1, 1.0
.NET Compact Framework
Unterstützt in: 2.0, 1.0
Siehe auch
Referenz
XmlTypeAttribute-Klasse
XmlTypeAttribute-Member
System.Xml.Serialization-Namespace