StringCollection.IList.Insert(Int32, Object) 메서드

정의

StringCollection의 지정된 인덱스에 요소를 삽입합니다.

 virtual void System.Collections.IList.Insert(int index, System::Object ^ value) = System::Collections::IList::Insert;
void IList.Insert (int index, object value);
void IList.Insert (int index, object? value);
abstract member System.Collections.IList.Insert : int * obj -> unit
override this.System.Collections.IList.Insert : int * obj -> unit
Sub Insert (index As Integer, value As Object) Implements IList.Insert

매개 변수

index
Int32

value을 삽입해야 하는 인덱스(0부터 시작)입니다.

value
Object

삽입할 Object입니다. 값은 null이 될 수 있습니다.

구현

예외

index가 0보다 작은 경우

또는

indexCount보다 큰 경우

StringCollection이 읽기 전용인 경우

또는

StringCollection가 고정 크기입니다.

설명

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

하는 경우 index 값과 같음 Countvalue 끝에 추가 됩니다 StringCollection합니다.

목록처럼 연속된 요소로 구성된 컬렉션에서는 삽입 지점 다음에 있는 요소를 아래로 이동하여 새 요소로 적용합니다. 컬렉션에 인덱스가 지정된 경우 이동되는 요소의 인덱스도 업데이트됩니다. 요소가 해시 테이블 같은 버킷으로 개념적으로 그룹화되어 있는 컬렉션에는 이러한 동작이 적용되지 않습니다.

이 메서드는 O (n) 작업, 여기서 nCount합니다.

적용 대상

추가 정보