Windows apps
Collapse the table of content
Expand the table of content
Information
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

XmlTypeAttribute::TypeName Property

 

Gets or sets the name of the XML type.

Namespace:   System.Xml.Serialization
Assembly:  System.Xml (in System.Xml.dll)

public:
property String^ TypeName {
	String^ get();
	void set(String^ value);
}

Property Value

Type: System::String^

The name of the XML type.

Apply the XmlTypeAttribute to a class to specify the XML type's namespace, the XML type name, and whether to include the type in the XML schema document. To see the results of setting the properties of the XmlTypeAttribute class, compile your application as an executable or DLL, and pass the resulting file to the XML Schema Definition Tool (Xsd.exe). The tool writes the schema, including the type definition.

The following example applies the XmlTypeAttribute to the Person and Job classes. If you compile the class and pass the resulting executable file to the XML Schema Definition tool, the schema is displayed in the Output section.

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;
};

Universal Windows Platform
Available since 8
.NET Framework
Available since 1.1
Portable Class Library
Supported in: portable .NET platforms
Silverlight
Available since 2.0
Windows Phone Silverlight
Available since 7.0
Windows Phone
Available since 8.1
Return to top
Show:
© 2017 Microsoft