ICollection 인터페이스

정의

제네릭이 아닌 모든 컬렉션에 대한 크기, 열거자 및 동기화 메서드를 정의합니다.

public interface class ICollection : System::Collections::IEnumerable
public interface ICollection : System.Collections.IEnumerable
[System.Runtime.InteropServices.ComVisible(true)]
public interface ICollection : System.Collections.IEnumerable
type ICollection = interface
    interface IEnumerable
[<System.Runtime.InteropServices.ComVisible(true)>]
type ICollection = interface
    interface IEnumerable
Public Interface ICollection
Implements IEnumerable
파생
특성
구현

설명

인터페이스는 ICollection 네임스페이스의 클래스에 대한 기본 인터페이스입니다 System.Collections . 해당 제네릭은 인터페이스입니다 System.Collections.Generic.ICollection<T> .

인터페이스는 ICollectionIDictionary 확장IEnumerable하며 를 IList 확장하는 ICollection보다 특수화된 인터페이스입니다. IDictionary 구현은 클래스와 같은 키/값 쌍의 컬렉션입니다Hashtable. IList 구현은 값의 컬렉션이며 클래스와 같은 인덱스로 해당 멤버에 ArrayList 액세스할 수 있습니다.

클래스 및 클래스와 같은 Queue 요소에 대한 액세스를 제한하는 일부 컬렉션은 Stack 인터페이스를 직접 구현합니다 ICollection .

인터페이스와 IList 인터페이스가 IDictionary 필요한 컬렉션의 요구 사항을 충족하지 않으면 더 많은 유연성을 위해 인터페이스에서 ICollection 새 컬렉션 클래스를 파생합니다.

이 인터페이스의 제네릭 버전은 를 참조하세요 System.Collections.Generic.ICollection<T>.

속성

Count

ICollection에 포함된 요소 수를 가져옵니다.

IsSynchronized

ICollection에 대한 액세스가 동기화되어 스레드로부터 안전하게 보호되는지를 나타내는 값을 가져옵니다.

SyncRoot

ICollection에 대한 액세스를 동기화하는 데 사용할 수 있는 개체를 가져옵니다.

메서드

CopyTo(Array, Int32)

특정 ICollection 인덱스부터 시작하여 Array의 요소를 Array에 복사합니다.

GetEnumerator()

컬렉션을 반복하는 열거자를 반환합니다.

(다음에서 상속됨 IEnumerable)

확장 메서드

Cast<TResult>(IEnumerable)

IEnumerable의 요소를 지정된 형식으로 캐스팅합니다.

OfType<TResult>(IEnumerable)

지정된 형식에 따라 IEnumerable의 요소를 필터링합니다.

AsParallel(IEnumerable)

쿼리를 병렬화할 수 있도록 합니다.

AsQueryable(IEnumerable)

IEnumerableIQueryable로 변환합니다.

적용 대상

추가 정보