Edit

Share via


XsdDataContractExporter.GetSchemaType(Type) Method

Definition

Returns the XML schema type for the specified type.

public:
 System::Xml::Schema::XmlSchemaType ^ GetSchemaType(Type ^ type);
[System.Diagnostics.CodeAnalysis.RequiresDynamicCode("Data Contract Serialization and Deserialization might require types that cannot be statically analyzed.")]
[System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("Data Contract Serialization and Deserialization might require types that cannot be statically analyzed. Make sure all of the required types are preserved.")]
public System.Xml.Schema.XmlSchemaType? GetSchemaType(Type type);
public System.Xml.Schema.XmlSchemaType? GetSchemaType(Type type);
[System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("Data Contract Serialization and Deserialization might require types that cannot be statically analyzed. Make sure all of the required types are preserved.")]
public System.Xml.Schema.XmlSchemaType? GetSchemaType(Type type);
public System.Xml.Schema.XmlSchemaType GetSchemaType(Type type);
[<System.Diagnostics.CodeAnalysis.RequiresDynamicCode("Data Contract Serialization and Deserialization might require types that cannot be statically analyzed.")>]
[<System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("Data Contract Serialization and Deserialization might require types that cannot be statically analyzed. Make sure all of the required types are preserved.")>]
member this.GetSchemaType : Type -> System.Xml.Schema.XmlSchemaType
member this.GetSchemaType : Type -> System.Xml.Schema.XmlSchemaType
[<System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("Data Contract Serialization and Deserialization might require types that cannot be statically analyzed. Make sure all of the required types are preserved.")>]
member this.GetSchemaType : Type -> System.Xml.Schema.XmlSchemaType
Public Function GetSchemaType (type As Type) As XmlSchemaType

Parameters

type
Type

The type to return a schema for.

Returns

An XmlSchemaType that contains the XML schema.

Attributes

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