Uredi

Deli z drugimi prek


XmlTypeAttribute.TypeName Property

Definition

Gets or sets the name of the XML type.

public:
 property System::String ^ TypeName { System::String ^ get(); void set(System::String ^ value); };
public string TypeName { get; set; }
member this.TypeName : string with get, set
Public Property TypeName As String

Property Value

The name of the XML type.

Examples

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

Remarks

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.

Applies to