CodeCommentStatementCollection Класс

Определение

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

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

Примеры

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

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

// Adds a CodeCommentStatement to the collection.
collection.Add( new CodeCommentStatement("Test comment") );

// Adds an array of CodeCommentStatement objects to the collection.
CodeCommentStatement[] comments = { new CodeCommentStatement("Test comment"), new CodeCommentStatement("Another test comment") };
collection.AddRange( comments );

// Adds a collection of CodeCommentStatement objects to the collection.
CodeCommentStatementCollection commentsCollection = new CodeCommentStatementCollection();
commentsCollection.Add( new CodeCommentStatement("Test comment") );
commentsCollection.Add( new CodeCommentStatement("Another test comment") );
collection.AddRange( commentsCollection );

// Tests for the presence of a CodeCommentStatement in the
// collection, and retrieves its index if it is found.
CodeCommentStatement testComment = new CodeCommentStatement("Test comment");
int itemIndex = -1;
if( collection.Contains( testComment ) )
    itemIndex = collection.IndexOf( testComment );

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

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

// Inserts a CodeCommentStatement at index 0 of the collection.
collection.Insert( 0, new CodeCommentStatement("Test comment") );

// Removes the specified CodeCommentStatement from the collection.
CodeCommentStatement comment = new CodeCommentStatement("Test comment");
collection.Remove( comment );

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

' Adds a CodeCommentStatement to the collection.
collection.Add(New CodeCommentStatement("Test comment"))

' Adds an array of CodeCommentStatement objects to the collection.
Dim comments As CodeCommentStatement() = {New CodeCommentStatement("Test comment"), New CodeCommentStatement("Another test comment")}
collection.AddRange(comments)

' Adds a collection of CodeCommentStatement objects to the 
' collection.
Dim commentsCollection As New CodeCommentStatementCollection()
commentsCollection.Add(New CodeCommentStatement("Test comment"))
commentsCollection.Add(New CodeCommentStatement("Another test comment"))
collection.AddRange(commentsCollection)

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

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

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

' Inserts a CodeCommentStatement at index 0 of the collection.
collection.Insert(0, New CodeCommentStatement("Test comment"))

' Removes the specified CodeCommentStatement from the collection.
Dim comment As New CodeCommentStatement("Test comment")
collection.Remove(comment)

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

Комментарии

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

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

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

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

CodeCommentStatementCollection(CodeCommentStatement[])

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

CodeCommentStatementCollection(CodeCommentStatementCollection)

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

Свойства

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

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

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

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

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

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

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

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

List

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

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

Методы

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

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

AddRange(CodeCommentStatement[])

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

AddRange(CodeCommentStatementCollection)

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

Clear()

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

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

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

CopyTo(CodeCommentStatement[], Int32)

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

Equals(Object)

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

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

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

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

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

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

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

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

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

Insert(Int32, CodeCommentStatement)

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

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

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

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 на основе указанного типа.

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

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