CodeAttributeArgumentCollection Класс

Определение

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

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

Примеры

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

// Creates an empty CodeAttributeArgumentCollection.
CodeAttributeArgumentCollection collection = new CodeAttributeArgumentCollection();

// Adds a CodeAttributeArgument to the collection.
collection.Add( new CodeAttributeArgument("Test Boolean Argument", new CodePrimitiveExpression(true)) );

// Adds an array of CodeAttributeArgument objects to the collection.
CodeAttributeArgument[] arguments = { new CodeAttributeArgument(), new CodeAttributeArgument() };
collection.AddRange( arguments );

// Adds a collection of CodeAttributeArgument objects to
// the collection.
CodeAttributeArgumentCollection argumentsCollection = new CodeAttributeArgumentCollection();
argumentsCollection.Add( new CodeAttributeArgument("TestBooleanArgument", new CodePrimitiveExpression(true)) );
argumentsCollection.Add( new CodeAttributeArgument("TestIntArgument", new CodePrimitiveExpression(1)) );
collection.AddRange( argumentsCollection );

// Tests for the presence of a CodeAttributeArgument
// within the collection, and retrieves its index if it is found.
CodeAttributeArgument testArgument = new CodeAttributeArgument("Test Boolean Argument", new CodePrimitiveExpression(true));
int itemIndex = -1;
if( collection.Contains( testArgument ) )
    itemIndex = collection.IndexOf( testArgument );

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

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

// Inserts a CodeAttributeArgument at index 0 of the collection.
collection.Insert( 0, new CodeAttributeArgument("Test Boolean Argument", new CodePrimitiveExpression(true)) );

// Removes the specified CodeAttributeArgument from the collection.
CodeAttributeArgument argument = new CodeAttributeArgument("Test Boolean Argument", new CodePrimitiveExpression(true));
collection.Remove( argument );

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

' Adds a CodeAttributeArgument to the collection.
collection.Add(New CodeAttributeArgument("Test Boolean Argument", New CodePrimitiveExpression(True)))

' Adds an array of CodeAttributeArgument objects to the collection.
Dim arguments As CodeAttributeArgument() = {New CodeAttributeArgument(), New CodeAttributeArgument()}
collection.AddRange(arguments)

' Adds a collection of CodeAttributeArgument objects to the collection.
Dim argumentsCollection As New CodeAttributeArgumentCollection()
argumentsCollection.Add(New CodeAttributeArgument("TestBooleanArgument", New CodePrimitiveExpression(True)))
argumentsCollection.Add(New CodeAttributeArgument("TestIntArgument", New CodePrimitiveExpression(1)))
collection.AddRange(argumentsCollection)

' Tests for the presence of a CodeAttributeArgument in 
' the collection, and retrieves its index if it is found.
Dim testArgument As New CodeAttributeArgument("Test Boolean Argument", New CodePrimitiveExpression(True))
Dim itemIndex As Integer = -1
If collection.Contains(testArgument) Then
    itemIndex = collection.IndexOf(testArgument)
End If

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

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

' Inserts a CodeAttributeArgument at index 0 of the collection.
collection.Insert(0, New CodeAttributeArgument("Test Boolean Argument", New CodePrimitiveExpression(True)))

' Removes the specified CodeAttributeArgument from the collection.
Dim argument As New CodeAttributeArgument("Test Boolean Argument", New CodePrimitiveExpression(True))
collection.Remove(argument)

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

Комментарии

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

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

Имя Описание
CodeAttributeArgumentCollection()

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

CodeAttributeArgumentCollection(CodeAttributeArgument[])

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

CodeAttributeArgumentCollection(CodeAttributeArgumentCollection)

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

Свойства

Имя Описание
Capacity

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

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

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

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

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

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

Возвращает или задает CodeAttributeArgument объект по указанному индексу в коллекции.

List

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

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

Методы

Имя Описание
Add(CodeAttributeArgument)

Добавляет указанный CodeAttributeArgument объект в коллекцию.

AddRange(CodeAttributeArgument[])

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

AddRange(CodeAttributeArgumentCollection)

Копирует содержимое другого CodeAttributeArgumentCollection объекта в конец коллекции.

Clear()

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

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

Возвращает значение, указывающее, содержит ли коллекция указанный CodeAttributeArgument объект.

CopyTo(CodeAttributeArgument[], Int32)

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

Equals(Object)

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

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

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

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

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

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

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

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

Возвращает индекс указанного CodeAttributeArgument объекта в коллекции, если он существует в коллекции.

Insert(Int32, CodeAttributeArgument)

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

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(CodeAttributeArgument)

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

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)

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

Имя Описание
AsParallel(IEnumerable)

Включает параллелизацию запроса.

AsQueryable(IEnumerable)

Преобразует IEnumerable в IQueryable.

Cast<TResult>(IEnumerable)

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

OfType<TResult>(IEnumerable)

Фильтрует элементы IEnumerable на основе указанного типа.

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

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