CodeAttributeDeclarationCollection Класс
Определение
Важно!
Некоторые сведения относятся к предварительной версии продукта, в которую до выпуска могут быть внесены существенные изменения. Майкрософт не предоставляет никаких гарантий, явных или подразумеваемых, относительно приведенных здесь сведений.
Представляет коллекцию CodeAttributeDeclaration объектов.
public ref class CodeAttributeDeclarationCollection : System::Collections::CollectionBase
[System.Runtime.InteropServices.ClassInterface(System.Runtime.InteropServices.ClassInterfaceType.AutoDispatch)]
[System.Runtime.InteropServices.ComVisible(true)]
[System.Serializable]
public class CodeAttributeDeclarationCollection : System.Collections.CollectionBase
[<System.Runtime.InteropServices.ClassInterface(System.Runtime.InteropServices.ClassInterfaceType.AutoDispatch)>]
[<System.Runtime.InteropServices.ComVisible(true)>]
[<System.Serializable>]
type CodeAttributeDeclarationCollection = class
inherit CollectionBase
Public Class CodeAttributeDeclarationCollection
Inherits CollectionBase
- Наследование
- Атрибуты
Примеры
В следующем примере показано использование CodeAttributeDeclarationCollection методов класса.
// Creates an empty CodeAttributeDeclarationCollection.
CodeAttributeDeclarationCollection collection = new CodeAttributeDeclarationCollection();
// Adds a CodeAttributeDeclaration to the collection.
collection.Add( new CodeAttributeDeclaration("DescriptionAttribute", new CodeAttributeArgument(new CodePrimitiveExpression("Test Description"))) );
// Adds an array of CodeAttributeDeclaration objects
// to the collection.
CodeAttributeDeclaration[] declarations = { new CodeAttributeDeclaration(), new CodeAttributeDeclaration() };
collection.AddRange( declarations );
// Adds a collection of CodeAttributeDeclaration objects
// to the collection.
CodeAttributeDeclarationCollection declarationsCollection = new CodeAttributeDeclarationCollection();
declarationsCollection.Add( new CodeAttributeDeclaration("DescriptionAttribute", new CodeAttributeArgument(new CodePrimitiveExpression("Test Description"))) );
declarationsCollection.Add( new CodeAttributeDeclaration("BrowsableAttribute", new CodeAttributeArgument(new CodePrimitiveExpression(true))) );
collection.AddRange( declarationsCollection );
// Tests for the presence of a CodeAttributeDeclaration in
// the collection, and retrieves its index if it is found.
CodeAttributeDeclaration testdeclaration = new CodeAttributeDeclaration("DescriptionAttribute", new CodeAttributeArgument(new CodePrimitiveExpression("Test Description")) );
int itemIndex = -1;
if( collection.Contains( testdeclaration ) )
itemIndex = collection.IndexOf( testdeclaration );
// Copies the contents of the collection, beginning at index 0,
// to the specified CodeAttributeDeclaration array.
// 'declarations' is a CodeAttributeDeclaration array.
collection.CopyTo( declarations, 0 );
// Retrieves the count of the items in the collection.
int collectionCount = collection.Count;
// Inserts a CodeAttributeDeclaration at index 0 of the collection.
collection.Insert( 0, new CodeAttributeDeclaration("DescriptionAttribute", new CodeAttributeArgument(new CodePrimitiveExpression("Test Description"))) );
// Removes the specified CodeAttributeDeclaration from
// the collection.
CodeAttributeDeclaration declaration = new CodeAttributeDeclaration("DescriptionAttribute", new CodeAttributeArgument(new CodePrimitiveExpression("Test Description")) );
collection.Remove( declaration );
// Removes the CodeAttributeDeclaration at index 0.
collection.RemoveAt(0);
' Creates an empty CodeAttributeDeclarationCollection.
Dim collection As New CodeAttributeDeclarationCollection()
' Adds a CodeAttributeDeclaration to the collection.
collection.Add(New CodeAttributeDeclaration("DescriptionAttribute", New CodeAttributeArgument(New CodePrimitiveExpression("Test Description"))))
' Adds an array of CodeAttributeDeclaration objects to the collection.
Dim declarations As CodeAttributeDeclaration() = {New CodeAttributeDeclaration(), New CodeAttributeDeclaration()}
collection.AddRange(declarations)
' Adds a collection of CodeAttributeDeclaration objects to
' the collection.
Dim declarationsCollection As New CodeAttributeDeclarationCollection()
declarationsCollection.Add(New CodeAttributeDeclaration("DescriptionAttribute", New CodeAttributeArgument(New CodePrimitiveExpression("Test Description"))))
declarationsCollection.Add(New CodeAttributeDeclaration("BrowsableAttribute", New CodeAttributeArgument(New CodePrimitiveExpression(True))))
collection.AddRange(declarationsCollection)
' Tests for the presence of a CodeAttributeDeclaration in the
' collection, and retrieves its index if it is found.
Dim testdeclaration As New CodeAttributeDeclaration("DescriptionAttribute", New CodeAttributeArgument(New CodePrimitiveExpression("Test Description")))
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 CodeAttributeDeclaration array.
' 'declarations' is a CodeAttributeDeclaration array.
collection.CopyTo(declarations, 0)
' Retrieves the count of the items in the collection.
Dim collectionCount As Integer = collection.Count
' Inserts a CodeAttributeDeclaration at index 0 of the collection.
collection.Insert(0, New CodeAttributeDeclaration("DescriptionAttribute", New CodeAttributeArgument(New CodePrimitiveExpression("Test Description"))))
' Removes the specified CodeAttributeDeclaration from the collection.
Dim declaration As New CodeAttributeDeclaration("DescriptionAttribute", New CodeAttributeArgument(New CodePrimitiveExpression("Test Description")))
collection.Remove(declaration)
' Removes the CodeAttributeDeclaration at index 0.
collection.RemoveAt(0)
Комментарии
Класс CodeAttributeDeclarationCollection предоставляет простой объект коллекции, который можно использовать для хранения набора CodeAttributeDeclaration объектов.
Конструкторы
| Имя | Описание |
|---|---|
| CodeAttributeDeclarationCollection() |
Инициализирует новый экземпляр класса CodeAttributeDeclarationCollection. |
| CodeAttributeDeclarationCollection(CodeAttributeDeclaration[]) |
Инициализирует новый экземпляр CodeAttributeDeclarationCollection класса, содержащего указанный массив CodeAttributeDeclaration объектов. |
| CodeAttributeDeclarationCollection(CodeAttributeDeclarationCollection) |
Инициализирует новый экземпляр CodeAttributeDeclarationCollection класса, содержащего элементы указанной исходной коллекции. |
Свойства
| Имя | Описание |
|---|---|
| Capacity |
Возвращает или задает количество элементов, которые CollectionBase могут содержаться. (Унаследовано от CollectionBase) |
| Count |
Возвращает количество элементов, содержащихся в экземпляре CollectionBase . Это свойство нельзя переопределить. (Унаследовано от CollectionBase) |
| InnerList |
ArrayList Возвращает список элементов в экземпляреCollectionBase. (Унаследовано от CollectionBase) |
| Item[Int32] |
Возвращает или задает CodeAttributeDeclaration объект по указанному индексу. |
| List |
IList Возвращает список элементов в экземпляреCollectionBase. (Унаследовано от CollectionBase) |
Методы
| Имя | Описание |
|---|---|
| Add(CodeAttributeDeclaration) |
CodeAttributeDeclaration Добавляет объект с указанным значением в коллекцию. |
| AddRange(CodeAttributeDeclaration[]) |
Копирует элементы указанного CodeAttributeDeclaration массива в конец коллекции. |
| AddRange(CodeAttributeDeclarationCollection) |
Копирует содержимое другого CodeAttributeDeclarationCollection объекта в конец коллекции. |
| Clear() |
Удаляет все объекты из экземпляра CollectionBase . Этот метод не может быть переопределен. (Унаследовано от CollectionBase) |
| Contains(CodeAttributeDeclaration) |
Возвращает или задает значение, указывающее, содержит ли коллекция указанный CodeAttributeDeclaration объект. |
| CopyTo(CodeAttributeDeclaration[], Int32) |
Копирует объекты коллекции в одномерный Array экземпляр, начинающийся с указанного индекса. |
| Equals(Object) |
Определяет, равен ли указанный объект текущему объекту. (Унаследовано от Object) |
| GetEnumerator() |
Возвращает перечислитель, который выполняет итерацию по экземпляру CollectionBase . (Унаследовано от CollectionBase) |
| GetHashCode() |
Служит хэш-функцией по умолчанию. (Унаследовано от Object) |
| GetType() |
Возвращает Type текущего экземпляра. (Унаследовано от Object) |
| IndexOf(CodeAttributeDeclaration) |
Возвращает индекс указанного CodeAttributeDeclaration объекта в коллекции, если он существует в коллекции. |
| Insert(Int32, CodeAttributeDeclaration) |
Вставляет указанный CodeAttributeDeclaration объект в коллекцию по указанному индексу. |
| 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(CodeAttributeDeclaration) |
Удаляет указанный CodeAttributeDeclaration объект из коллекции. |
| 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 на основе указанного типа. |