XmlSchemaObjectCollection.Add(XmlSchemaObject) 메서드

정의

XmlSchemaObjectXmlSchemaObjectCollection을 추가합니다.

public:
 int Add(System::Xml::Schema::XmlSchemaObject ^ item);
public int Add (System.Xml.Schema.XmlSchemaObject item);
member this.Add : System.Xml.Schema.XmlSchemaObject -> int
Public Function Add (item As XmlSchemaObject) As Integer

매개 변수

반환

Int32

항목이 추가된 인덱스입니다.

예외

index가 0보다 작은 경우

또는 indexCount보다 큰 경우

지정된 XmlSchemaObject 매개 변수는 XmlSchemaExternal 형식 또는 파생된 XmlSchemaImport, XmlSchemaIncludeXmlSchemaRedefine 형식이 아닙니다.

설명

이미 용량과 같으면 Count 내부 배열을 자동으로 다시 할당하고 새 요소가 추가되기 전에 기존 요소를 새 배열에 복사하여 목록 용량이 두 배가 됩니다.

용량보다 작은 경우 Count 이 메서드는 0(1) 작업입니다. 새 요소를 수용하기 위해 용량을 늘려야 하는 경우 이 메서드는 n이 있는 Count0(n) 작업이 됩니다.

메서드에는 Add 매개 변수로 파생된 형식(XmlSchemaImportXmlSchemaIncludeXmlSchemaRedefine)만 XmlSchemaExternal 필요합니다. 다음 예제에서는 기존 개체의 컬렉션에 Includes 포함된 스키마를 추가하는 방법을 보여 줍니다 XmlSchema .

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);  
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);  

적용 대상