CodeTypeReferenceCollection Класс

Определение

Представляет коллекцию объектов CodeTypeReference.

public ref class CodeTypeReferenceCollection : System::Collections::CollectionBase
public class CodeTypeReferenceCollection : System.Collections.CollectionBase
[System.Runtime.InteropServices.ClassInterface(System.Runtime.InteropServices.ClassInterfaceType.AutoDispatch)]
[System.Runtime.InteropServices.ComVisible(true)]
[System.Serializable]
public class CodeTypeReferenceCollection : System.Collections.CollectionBase
type CodeTypeReferenceCollection = class
    inherit CollectionBase
[<System.Runtime.InteropServices.ClassInterface(System.Runtime.InteropServices.ClassInterfaceType.AutoDispatch)>]
[<System.Runtime.InteropServices.ComVisible(true)>]
[<System.Serializable>]
type CodeTypeReferenceCollection = class
    inherit CollectionBase
Public Class CodeTypeReferenceCollection
Inherits CollectionBase
Наследование
CodeTypeReferenceCollection
Атрибуты

Примеры

// Creates an empty CodeTypeReferenceCollection.
CodeTypeReferenceCollection^ collection = gcnew CodeTypeReferenceCollection;

// Adds a CodeTypeReference to the collection.
collection->Add( gcnew CodeTypeReference( bool::typeid ) );

// Adds an array of CodeTypeReference objects to the collection.
array<CodeTypeReference^>^references = {gcnew CodeTypeReference( bool::typeid ),gcnew CodeTypeReference( bool::typeid )};
collection->AddRange( references );

// Adds a collection of CodeTypeReference objects to the collection.
CodeTypeReferenceCollection^ referencesCollection = gcnew CodeTypeReferenceCollection;
referencesCollection->Add( gcnew CodeTypeReference( bool::typeid ) );
referencesCollection->Add( gcnew CodeTypeReference( bool::typeid ) );
collection->AddRange( referencesCollection );

// Tests for the presence of a CodeTypeReference in the 
// collection, and retrieves its index if it is found.
CodeTypeReference^ testReference = gcnew CodeTypeReference( bool::typeid );
int itemIndex = -1;
if ( collection->Contains( testReference ) )
   itemIndex = collection->IndexOf( testReference );

// Copies the contents of the collection, beginning at index 0, 
// to the specified CodeTypeReference array.
// 'references' is a CodeTypeReference array.
collection->CopyTo( references, 0 );

// Retrieves the count of the items in the collection.
int collectionCount = collection->Count;

// Inserts a CodeTypeReference at index 0 of the collection.
collection->Insert( 0, gcnew CodeTypeReference( bool::typeid ) );

// Removes the specified CodeTypeReference from the collection.
CodeTypeReference^ reference = gcnew CodeTypeReference( bool::typeid );
collection->Remove( reference );

// Removes the CodeTypeReference at index 0.
collection->RemoveAt( 0 );
// Creates an empty CodeTypeReferenceCollection.
CodeTypeReferenceCollection collection = new CodeTypeReferenceCollection();

// Adds a CodeTypeReference to the collection.
collection.Add( new CodeTypeReference(typeof(bool)) );

// Adds an array of CodeTypeReference objects to the collection.
CodeTypeReference[] references = { new CodeTypeReference(typeof(bool)), new CodeTypeReference(typeof(bool)) };
collection.AddRange( references );

// Adds a collection of CodeTypeReference objects to the collection.
CodeTypeReferenceCollection referencesCollection = new CodeTypeReferenceCollection();
referencesCollection.Add( new CodeTypeReference(typeof(bool)) );
referencesCollection.Add( new CodeTypeReference(typeof(bool)) );
collection.AddRange( referencesCollection );

// Tests for the presence of a CodeTypeReference in the
// collection, and retrieves its index if it is found.
CodeTypeReference testReference = new CodeTypeReference(typeof(bool));
int itemIndex = -1;
if( collection.Contains( testReference ) )
    itemIndex = collection.IndexOf( testReference );

// Copies the contents of the collection, beginning at index 0,
// to the specified CodeTypeReference array.
// 'references' is a CodeTypeReference array.
collection.CopyTo( references, 0 );

// Retrieves the count of the items in the collection.
int collectionCount = collection.Count;

// Inserts a CodeTypeReference at index 0 of the collection.
collection.Insert( 0, new CodeTypeReference(typeof(bool)) );

// Removes the specified CodeTypeReference from the collection.
CodeTypeReference reference = new CodeTypeReference(typeof(bool));
collection.Remove( reference );

// Removes the CodeTypeReference at index 0.
collection.RemoveAt(0);
' Creates an empty CodeTypeReferenceCollection.
Dim collection As New CodeTypeReferenceCollection()

' Adds a CodeTypeReference to the collection.
collection.Add(New CodeTypeReference(GetType(Boolean)))

' Adds an array of CodeTypeReference objects to the collection.
Dim references As CodeTypeReference() = {New CodeTypeReference(GetType(Boolean)), New CodeTypeReference(GetType(Boolean))}
collection.AddRange(references)

' Adds a collection of CodeTypeReference objects to the collection.
Dim referencesCollection As New CodeTypeReferenceCollection()
referencesCollection.Add(New CodeTypeReference(GetType(Boolean)))
referencesCollection.Add(New CodeTypeReference(GetType(Boolean)))
collection.AddRange(referencesCollection)

' Tests for the presence of a CodeTypeReference in the 
' collection, and retrieves its index if it is found.
Dim testReference As New CodeTypeReference(GetType(Boolean))
Dim itemIndex As Integer = -1
If collection.Contains(testReference) Then
    itemIndex = collection.IndexOf(testReference)
End If

' Copies the contents of the collection, beginning at index 0, 
' to the specified CodeTypeReference array.
' 'references' is a CodeTypeReference array.
collection.CopyTo(references, 0)

' Retrieves the count of the items in the collection.
Dim collectionCount As Integer = collection.Count

' Inserts a CodeTypeReference at index 0 of the collection.
collection.Insert(0, New CodeTypeReference(GetType(Boolean)))

' Removes the specified CodeTypeReference from the collection.
Dim reference As New CodeTypeReference(GetType(Boolean))
collection.Remove(reference)

' Removes the CodeTypeReference at index 0.
collection.RemoveAt(0)

Комментарии

Класс CodeTypeReferenceCollection предоставляет простой объект коллекции, который можно использовать для хранения набора объектов CodeTypeReference.

Конструкторы

CodeTypeReferenceCollection()

Инициализирует новый экземпляр класса CodeTypeReferenceCollection.

CodeTypeReferenceCollection(CodeTypeReference[])

Инициализирует новый экземпляр класса CodeTypeReferenceCollection, содержащий указанный массив объектов CodeTypeReference.

CodeTypeReferenceCollection(CodeTypeReferenceCollection)

Инициализирует новый экземпляр класса CodeTypeReferenceCollection, содержащий элементы указанной исходной коллекции.

Свойства

Capacity

Возвращает или задает число элементов, которое может содержать список CollectionBase.

(Унаследовано от CollectionBase)
Count

Возвращает количество элементов, содержащихся в экземпляре CollectionBase. Это свойство нельзя переопределить.

(Унаследовано от CollectionBase)
InnerList

Возвращает объект ArrayList, в котором хранится список элементов экземпляра класса CollectionBase.

(Унаследовано от CollectionBase)
Item[Int32]

Получает или задает CodeTypeReference по указанному индексу в коллекции.

List

Возвращает объект IList, в котором хранится список элементов экземпляра класса CollectionBase.

(Унаследовано от CollectionBase)

Методы

Add(CodeTypeReference)

Добавляет указанный параметр CodeTypeReference в коллекцию.

Add(String)

Добавляет CodeTypeReference к коллекции, используя указанное имя типа данных.

Add(Type)

Добавляет CodeTypeReference к коллекции, используя указанный тип данных.

AddRange(CodeTypeReference[])

Копирует элементы указанного массива CodeTypeReference в конец коллекции.

AddRange(CodeTypeReferenceCollection)

Добавляет содержимое указанной CodeTypeReferenceCollection в конец коллекции.

Clear()

Удаляет все объекты из экземпляра класса CollectionBase. Этот метод не может быть переопределен.

(Унаследовано от CollectionBase)
Contains(CodeTypeReference)

Получает значение, показывающее, содержит ли коллекция указанную CodeTypeReference.

CopyTo(CodeTypeReference[], Int32)

Копирует элементы коллекции в указанный одномерный Array по указанному индексу.

Equals(Object)

Определяет, равен ли указанный объект текущему объекту.

(Унаследовано от Object)
GetEnumerator()

Возвращает перечислитель, перебирающий элементы экземпляра класса CollectionBase.

(Унаследовано от CollectionBase)
GetHashCode()

Служит хэш-функцией по умолчанию.

(Унаследовано от Object)
GetType()

Возвращает объект Type для текущего экземпляра.

(Унаследовано от Object)
IndexOf(CodeTypeReference)

Получает индекс в коллекции указанной CodeTypeReference, если он существует в коллекции.

Insert(Int32, CodeTypeReference)

Вставляет в коллекцию объект CodeTypeReference по указанному индексу.

MemberwiseClone()

Создает неполную копию текущего объекта Object.

(Унаследовано от Object)
OnClear()

Выполняет дополнительные пользовательские действия при очистке содержимого экземпляра CollectionBase.

(Унаследовано от CollectionBase)
OnClearComplete()

Осуществляет дополнительные пользовательские действия после удаления содержимого экземпляра класса CollectionBase.

(Унаследовано от CollectionBase)
OnInsert(Int32, Object)

Выполняет дополнительные пользовательские действия перед вставкой нового элемента в экземпляр класса CollectionBase.

(Унаследовано от CollectionBase)
OnInsertComplete(Int32, Object)

Выполняет дополнительные пользовательские действия после вставки нового элемента в экземпляр класса CollectionBase.

(Унаследовано от CollectionBase)
OnRemove(Int32, Object)

Осуществляет дополнительные пользовательские действия при удалении элемента из экземпляра класса CollectionBase.

(Унаследовано от CollectionBase)
OnRemoveComplete(Int32, Object)

Осуществляет дополнительные пользовательские действия после удаления элемента из экземпляра класса CollectionBase.

(Унаследовано от CollectionBase)
OnSet(Int32, Object, Object)

Выполняет дополнительные пользовательские действия перед заданием значения в экземпляре класса CollectionBase.

(Унаследовано от CollectionBase)
OnSetComplete(Int32, Object, Object)

Выполняет дополнительные пользовательские действия после задания значения в экземпляре класса CollectionBase.

(Унаследовано от CollectionBase)
OnValidate(Object)

Выполняет дополнительные пользовательские операции при проверке значения.

(Унаследовано от CollectionBase)
Remove(CodeTypeReference)

Удаляет указанный объект CodeTypeReference из коллекции.

RemoveAt(Int32)

Удаляет элемент по указанному индексу в экземпляре класса CollectionBase. Этот метод нельзя переопределить.

(Унаследовано от CollectionBase)
ToString()

Возвращает строку, представляющую текущий объект.

(Унаследовано от Object)

Явные реализации интерфейса

ICollection.CopyTo(Array, Int32)

Копирует целый массив CollectionBase в совместимый одномерный массив Array, начиная с заданного индекса целевого массива.

(Унаследовано от CollectionBase)
ICollection.IsSynchronized

Возвращает значение, показывающее, является ли доступ к коллекции CollectionBase синхронизированным (потокобезопасным).

(Унаследовано от CollectionBase)
ICollection.SyncRoot

Получает объект, с помощью которого можно синхронизировать доступ к коллекции CollectionBase.

(Унаследовано от CollectionBase)
IList.Add(Object)

Добавляет объект в конец коллекции CollectionBase.

(Унаследовано от CollectionBase)
IList.Contains(Object)

Определяет, содержит ли интерфейс CollectionBase определенный элемент.

(Унаследовано от CollectionBase)
IList.IndexOf(Object)

Осуществляет поиск указанного объекта Object и возвращает отсчитываемый от нуля индекс первого вхождения в коллекцию CollectionBase.

(Унаследовано от CollectionBase)
IList.Insert(Int32, Object)

Вставляет элемент в коллекцию CollectionBase по указанному индексу.

(Унаследовано от CollectionBase)
IList.IsFixedSize

Получает значение, указывающее, имеет ли список CollectionBase фиксированный размер.

(Унаследовано от CollectionBase)
IList.IsReadOnly

Получает значение, указывающее, является ли объект CollectionBase доступным только для чтения.

(Унаследовано от CollectionBase)
IList.Item[Int32]

Возвращает или задает элемент по указанному индексу.

(Унаследовано от CollectionBase)
IList.Remove(Object)

Удаляет первое вхождение указанного объекта из коллекции CollectionBase.

(Унаследовано от CollectionBase)

Методы расширения

Cast<TResult>(IEnumerable)

Приводит элементы объекта IEnumerable к заданному типу.

OfType<TResult>(IEnumerable)

Выполняет фильтрацию элементов объекта IEnumerable по заданному типу.

AsParallel(IEnumerable)

Позволяет осуществлять параллельный запрос.

AsQueryable(IEnumerable)

Преобразовывает коллекцию IEnumerable в объект IQueryable.

Применяется к

См. также раздел