XsdDataContractExporter.GetSchemaType(Type) Method

Definition

Returns the XML schema type for the specified type.

C#
public System.Xml.Schema.XmlSchemaType? GetSchemaType(Type type);
C#
public System.Xml.Schema.XmlSchemaType GetSchemaType(Type type);

Parameters

type
Type

The type to return a schema for.

Returns

An XmlSchemaType that contains the XML schema.

Exceptions

The type argument is null.

Remarks

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.

Applies to

Product Versions
.NET Core 2.0, Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7, 8, 9, 10
.NET Framework 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
.NET Standard 2.0, 2.1