XmlSchemaObjectCollection.Add(XmlSchemaObject) 메서드
정의
중요
일부 정보는 릴리스되기 전에 상당 부분 수정될 수 있는 시험판 제품과 관련이 있습니다. Microsoft는 여기에 제공된 정보에 대해 어떠한 명시적이거나 묵시적인 보증도 하지 않습니다.
에 추가합니다 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
매개 변수
- item
- XmlSchemaObject
XmlSchemaObject 컬렉션에 추가할 개체입니다.
반품
항목이 추가된 인덱스입니다.
예외
XmlSchemaObject 지정된 매개 변수가 형식 또는 파생 형식 XmlSchemaExternalXmlSchemaImportXmlSchemaInclude이 아닌 경우 .XmlSchemaRedefine
설명
이미 용량과 같으면 Count 내부 배열을 자동으로 다시 할당하고 새 요소가 추가되기 전에 기존 요소를 새 배열에 복사하여 목록의 용량이 두 배로 증가합니다.
용량보다 작으면 Count 이 메서드는 0(1) 작업입니다. 새 요소를 수용하기 위해 용량을 늘려야 하는 경우 이 메서드는 n이 있는 Count0(n) 작업이 됩니다.
메서드는 Add 매개 변수로 파생된 형식(XmlSchemaImport및XmlSchemaIncludeXmlSchemaRedefine)만 XmlSchemaExternal 필요합니다. 다음 예제에서는 기존 XmlSchema 개체의 컬렉션에 Includes 포함된 스키마를 추가하는 방법을 보여 줍니다.
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);