XsdDataContractExporter.GetSchemaType Method (Type)


The .NET API Reference documentation has a new home. Visit the .NET API Browser on docs.microsoft.com to see the new experience.

Returns the XML schema type for the specified type.

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

public XmlSchemaType GetSchemaType(
	Type type


Type: System.Type

The type to return a schema for.

Return Value

Type: System.Xml.Schema.XmlSchemaType

An XmlSchemaType that contains the XML schema.

Exception Condition

The type argument is null.

The main purpose of this method is to allow anonymous types in XML schema to be represented. Because anonymous types do not have a contract name and namespace, they cannot be looked up using the GetSchemaTypeName. This method returns the XmlSchemaType definition for such types. The types for which the GetSchemaTypeName method returns a valid name, this method returns null.

.NET Framework
Available since 3.0
Return to top