CodeTypeDeclarationCollection 클래스
정의
중요
일부 정보는 릴리스되기 전에 상당 부분 수정될 수 있는 시험판 제품과 관련이 있습니다. Microsoft는 여기에 제공된 정보에 대해 어떠한 명시적이거나 묵시적인 보증도 하지 않습니다.
개체의 CodeTypeDeclaration 컬렉션을 나타냅니다.
public ref class CodeTypeDeclarationCollection : System::Collections::CollectionBase
[System.Runtime.InteropServices.ClassInterface(System.Runtime.InteropServices.ClassInterfaceType.AutoDispatch)]
[System.Runtime.InteropServices.ComVisible(true)]
[System.Serializable]
public class CodeTypeDeclarationCollection : System.Collections.CollectionBase
[<System.Runtime.InteropServices.ClassInterface(System.Runtime.InteropServices.ClassInterfaceType.AutoDispatch)>]
[<System.Runtime.InteropServices.ComVisible(true)>]
[<System.Serializable>]
type CodeTypeDeclarationCollection = class
inherit CollectionBase
Public Class CodeTypeDeclarationCollection
Inherits CollectionBase
- 상속
- 특성
예제
다음 예제에서는 클래스를 사용하는 방법을 보여 줍니다 CodeTypeDeclarationCollection . 이 예제에서는 클래스의 새 인스턴스를 만들고 여러 메서드를 사용하여 컬렉션에 문을 추가하고, 인덱스를 반환하고, 특정 인덱스 지점에서 특성을 추가하거나 제거합니다.
// Creates an empty CodeTypeDeclarationCollection.
CodeTypeDeclarationCollection collection = new CodeTypeDeclarationCollection();
// Adds a CodeTypeDeclaration to the collection.
collection.Add( new CodeTypeDeclaration("TestType") );
// Adds an array of CodeTypeDeclaration objects to the collection.
CodeTypeDeclaration[] declarations = { new CodeTypeDeclaration("TestType1"), new CodeTypeDeclaration("TestType2") };
collection.AddRange( declarations );
// Adds a collection of CodeTypeDeclaration objects to the
// collection.
CodeTypeDeclarationCollection declarationsCollection = new CodeTypeDeclarationCollection();
declarationsCollection.Add( new CodeTypeDeclaration("TestType1") );
declarationsCollection.Add( new CodeTypeDeclaration("TestType2") );
collection.AddRange( declarationsCollection );
// Tests for the presence of a CodeTypeDeclaration in the
// collection, and retrieves its index if it is found.
CodeTypeDeclaration testDeclaration = new CodeTypeDeclaration("TestType");
int itemIndex = -1;
if( collection.Contains( testDeclaration ) )
itemIndex = collection.IndexOf( testDeclaration );
// Copies the contents of the collection, beginning at index 0,
// to the specified CodeTypeDeclaration array.
// 'declarations' is a CodeTypeDeclaration array.
collection.CopyTo( declarations, 0 );
// Retrieves the count of the items in the collection.
int collectionCount = collection.Count;
// Inserts a CodeTypeDeclaration at index 0 of the collection.
collection.Insert( 0, new CodeTypeDeclaration("TestType") );
// Removes the specified CodeTypeDeclaration from the collection.
CodeTypeDeclaration declaration = new CodeTypeDeclaration("TestType");
collection.Remove( declaration );
// Removes the CodeTypeDeclaration at index 0.
collection.RemoveAt(0);
' Creates an empty CodeTypeDeclarationCollection.
Dim collection As New CodeTypeDeclarationCollection()
' Adds a CodeTypeDeclaration to the collection.
collection.Add(New CodeTypeDeclaration("TestType"))
' Adds an array of CodeTypeDeclaration objects to the
' collection.
Dim declarations As CodeTypeDeclaration() = {New CodeTypeDeclaration("TestType1"), New CodeTypeDeclaration("TestType2")}
collection.AddRange(declarations)
' Adds a collection of CodeTypeDeclaration objects to the collection.
Dim declarationsCollection As New CodeTypeDeclarationCollection()
declarationsCollection.Add(New CodeTypeDeclaration("TestType1"))
declarationsCollection.Add(New CodeTypeDeclaration("TestType2"))
collection.AddRange(declarationsCollection)
' Tests for the presence of a CodeTypeDeclaration in the
' collection, and retrieves its index if it is found.
Dim testDeclaration As New CodeTypeDeclaration("TestType")
Dim itemIndex As Integer = -1
If collection.Contains(testDeclaration) Then
itemIndex = collection.IndexOf(testDeclaration)
End If
' Copies the contents of the collection, beginning at index 0,
' to the specified CodeTypeDeclaration array.
' 'declarations' is a CodeTypeDeclaration array.
collection.CopyTo(declarations, 0)
' Retrieves the count of the items in the collection.
Dim collectionCount As Integer = collection.Count
' Inserts a CodeTypeDeclaration at index 0 of the collection.
collection.Insert(0, New CodeTypeDeclaration("TestType"))
' Removes the specified CodeTypeDeclaration from the collection.
Dim declaration As New CodeTypeDeclaration("TestType")
collection.Remove(declaration)
' Removes the CodeTypeDeclaration at index 0.
collection.RemoveAt(0)
설명
클래스는 CodeTypeDeclarationCollection 개체 집합 CodeTypeDeclaration 을 저장하는 데 사용할 수 있는 간단한 컬렉션 개체를 제공합니다.
생성자
| Name | Description |
|---|---|
| CodeTypeDeclarationCollection() |
CodeTypeDeclarationCollection 클래스의 새 인스턴스를 초기화합니다. |
| CodeTypeDeclarationCollection(CodeTypeDeclaration[]) |
지정된 개체 배열 CodeTypeDeclaration 을 CodeTypeDeclarationCollection 포함하는 클래스의 새 인스턴스를 초기화합니다. |
| CodeTypeDeclarationCollection(CodeTypeDeclarationCollection) |
지정된 소스 컬렉션의 CodeTypeDeclarationCollection 요소를 포함하는 클래스의 새 인스턴스를 초기화합니다. |
속성
| Name | Description |
|---|---|
| Capacity |
포함할 수 있는 CollectionBase 요소의 수를 가져오거나 설정합니다. (다음에서 상속됨 CollectionBase) |
| Count |
인스턴스에 포함된 CollectionBase 요소 수를 가져옵니다. 이 속성은 재정의할 수 없습니다. (다음에서 상속됨 CollectionBase) |
| InnerList |
인스턴스의 ArrayList 요소 CollectionBase 목록을 포함하는 항목을 가져옵니다. (다음에서 상속됨 CollectionBase) |
| Item[Int32] |
컬렉션의 CodeTypeDeclaration 지정된 인덱스에서 개체를 가져오거나 설정합니다. |
| List |
인스턴스의 IList 요소 CollectionBase 목록을 포함하는 항목을 가져옵니다. (다음에서 상속됨 CollectionBase) |
메서드
명시적 인터페이스 구현
확장명 메서드
| Name | Description |
|---|---|
| AsParallel(IEnumerable) |
쿼리의 병렬 처리를 사용하도록 설정합니다. |
| AsQueryable(IEnumerable) |
IEnumerable IQueryable변환합니다. |
| Cast<TResult>(IEnumerable) |
IEnumerable 요소를 지정된 형식으로 캐스팅합니다. |
| OfType<TResult>(IEnumerable) |
지정된 형식에 따라 IEnumerable 요소를 필터링합니다. |