Adds an System.Xml.Schema.XmlSchemaObject to the XmlSchemaObjectCollection.
- item
- The System.Xml.Schema.XmlSchemaObject.
The index at which the item has been added.
If Count already equals the capacity, the capacity of list is doubled by automatically reallocating the internal array and copying the existing elements to the new array before the new element is added.
If Count is less than the capacity, this method is an 0(1) operation. If the capacity needs to be increased to accommodate the new element, this method becomes an 0(n) operation, where n is Count.
The XmlSchemaObjectCollection.Add(XmlSchemaObject) method expects only System.Xml.Schema.XmlSchemaExternal and its derived types (System.Xml.Schema.XmlSchemaImport, System.Xml.Schema.XmlSchemaInclude, and System.Xml.Schema.XmlSchemaRedefine) as parameters. The following example illustrates adding an included schema to the XmlSchema.Includes collection of an existing System.Xml.Schema.XmlSchema object.
Example
Dim schema As XmlSchema = New XmlSchema() Dim textReader As XmlTextReader = New XmlTextReader("include.xsd") Dim includeSchema As XmlSchema = XmlSchema.Read(textReader, null) Dim include As XmlSchemaInclude = New XmlSchemaInclude() include.Schema = includeSchema; schema.Includes.Add(include);
Example
XmlSchema schema = new XmlSchema(); XmlTextReader textReader = new XmlTextReader("include.xsd"); XmlSchema includeSchema = XmlSchema.Read(textReader, null); XmlSchemaInclude include = new XmlSchemaInclude(); include.Schema = includeSchema; schema.Includes.Add(include);