When applied to a type, stores the name of a static method of the type that returns an XML schema and a System.Xml.XmlQualifiedName (or System.Xml.Schema.XmlSchemaType for anonymous types) that controls the serialization of the type.
See Also: XmlSchemaProviderAttribute Members
The main purpose of the System.Xml.Serialization.XmlSchemaProviderAttribute is to enable the System.Xml.Serialization.XmlSchemaExporter class to return a schema when queried by the Web Services Description Language tool (WSDL.exe), or when using the Add Web Reference feature of vsprvs. You can control the actual schema for the type in the static method.
The target class of the attribute must implement the System.Xml.Serialization.IXmlSerializable interface.
The XmlSchemaProviderAttribute.MethodName property returns the name of a static method through reflection. The method, which must be implemented, must take a single parameter, an System.Xml.Schema.XmlSchemaSet object, which the method populates with an System.Xml.Schema.XmlSchema object. The method must also return an System.Xml.XmlQualifiedName object that identifies the data type.
An anonymous complex type cannot be created using a method that returns System.Xml.XmlQualifiedName. Because an anonymous type has no name, and you cannot add an anonymous type to a schema, the anonymous type must be returned as an System.Xml.Schema.XmlSchemaType.