CodeCommentStatementCollection Classe
Definição
Importante
Algumas informações dizem respeito a um produto pré-lançado que pode ser substancialmente modificado antes de ser lançado. A Microsoft não faz garantias, de forma expressa ou implícita, em relação à informação aqui apresentada.
Representa uma coleção de CodeCommentStatement objetos.
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
- Herança
- Atributos
Exemplos
O exemplo seguinte demonstra a utilização dos CodeCommentStatementCollection métodos de classe. O exemplo cria uma nova instância da classe e utiliza os métodos para adicionar instruções à coleção, devolver o seu índice e adicionar ou remover atributos num ponto de índice específico.
// 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)
Observações
A CodeCommentStatementCollection classe fornece um objeto de coleção simples que pode ser usado para armazenar um conjunto de CodeCommentStatement objetos.
Construtores
| Name | Description |
|---|---|
| CodeCommentStatementCollection() |
Inicializa uma nova instância da CodeCommentStatementCollection classe. |
| CodeCommentStatementCollection(CodeCommentStatement[]) |
Inicializa uma nova instância da CodeCommentStatementCollection classe que contém o array especificado de CodeCommentStatement objetos. |
| CodeCommentStatementCollection(CodeCommentStatementCollection) |
Inicializa uma nova instância da CodeCommentStatementCollection classe que contém os elementos da coleção de fontes especificada. |
Propriedades
| Name | Description |
|---|---|
| Capacity |
Obtém ou define o número de elementos que podem CollectionBase conter. (Herdado de CollectionBase) |
| Count |
Obtém o número de elementos contidos na CollectionBase instância. Esta propriedade não pode ser substituída. (Herdado de CollectionBase) |
| InnerList |
Obtém um ArrayList contendo a lista de elementos na CollectionBase instância. (Herdado de CollectionBase) |
| Item[Int32] |
Obtém ou define o CodeCommentStatement objeto no índice especificado na coleção. |
| List |
Obtém um IList contendo a lista de elementos na CollectionBase instância. (Herdado de CollectionBase) |
Métodos
| Name | Description |
|---|---|
| Add(CodeCommentStatement) |
Adiciona o objeto especificado CodeCommentStatement à coleção. |
| AddRange(CodeCommentStatement[]) |
Copia os elementos do array especificado CodeCommentStatement para o final da coleção. |
| AddRange(CodeCommentStatementCollection) |
Copia o conteúdo de outro CodeCommentStatementCollection objeto para o final da coleção. |
| Clear() |
Remove todos os objetos da CollectionBase instância. Este método não pode ser ultrapassado. (Herdado de CollectionBase) |
| Contains(CodeCommentStatement) |
Recebe um valor que indica se a coleção contém o objeto especificado CodeCommentStatement . |
| CopyTo(CodeCommentStatement[], Int32) |
Copia os objetos da coleção para o índice unidimensional Array especificado, começando no índice especificado. |
| Equals(Object) |
Determina se o objeto especificado é igual ao objeto atual. (Herdado de Object) |
| GetEnumerator() |
Devolve um enumerador que itera pela CollectionBase instância. (Herdado de CollectionBase) |
| GetHashCode() |
Serve como função de hash predefinida. (Herdado de Object) |
| GetType() |
Obtém o Type da instância atual. (Herdado de Object) |
| IndexOf(CodeCommentStatement) |
Obtém o índice do objeto especificado CodeCommentStatement na coleção, se este existir na coleção. |
| Insert(Int32, CodeCommentStatement) |
Insere um CodeCommentStatement objeto na coleção no índice especificado. |
| MemberwiseClone() |
Cria uma cópia superficial do atual Object. (Herdado de Object) |
| OnClear() |
Realiza processos personalizados adicionais ao limpar o conteúdo da CollectionBase instância. (Herdado de CollectionBase) |
| OnClearComplete() |
Realiza processos personalizados adicionais após limpar o conteúdo da CollectionBase instância. (Herdado de CollectionBase) |
| OnInsert(Int32, Object) |
Realiza processos personalizados adicionais antes de inserir um novo elemento na CollectionBase instância. (Herdado de CollectionBase) |
| OnInsertComplete(Int32, Object) |
Executa processos personalizados adicionais após inserir um novo elemento na CollectionBase instância. (Herdado de CollectionBase) |
| OnRemove(Int32, Object) |
Realiza processos personalizados adicionais ao remover um elemento da CollectionBase instância. (Herdado de CollectionBase) |
| OnRemoveComplete(Int32, Object) |
Executa processos personalizados adicionais após remover um elemento da CollectionBase instância. (Herdado de CollectionBase) |
| OnSet(Int32, Object, Object) |
Realiza processos personalizados adicionais antes de definir um valor na CollectionBase instância. (Herdado de CollectionBase) |
| OnSetComplete(Int32, Object, Object) |
Executa processos personalizados adicionais após definir um valor na CollectionBase instância. (Herdado de CollectionBase) |
| OnValidate(Object) |
Realiza processos personalizados adicionais ao validar um valor. (Herdado de CollectionBase) |
| Remove(CodeCommentStatement) |
Remove o objeto especificado CodeCommentStatement da coleção. |
| RemoveAt(Int32) |
Remove o elemento no índice especificado da CollectionBase instância. Este método não é ultrapassível. (Herdado de CollectionBase) |
| ToString() |
Devolve uma cadeia que representa o objeto atual. (Herdado de Object) |
Implementações de Interface Explícita
| Name | Description |
|---|---|
| ICollection.CopyTo(Array, Int32) |
Copia a totalidade CollectionBase para uma unidimensional Arraycompatível , começando no índice especificado do array alvo. (Herdado de CollectionBase) |
| ICollection.IsSynchronized |
Recebe um valor que indica se o acesso ao CollectionBase é sincronizado (thread safe). (Herdado de CollectionBase) |
| ICollection.SyncRoot |
Obtém um objeto que pode ser usado para sincronizar o acesso ao CollectionBase. (Herdado de CollectionBase) |
| IList.Add(Object) |
Adiciona um objeto ao final do CollectionBase. (Herdado de CollectionBase) |
| IList.Contains(Object) |
Determina se o CollectionBase contém um elemento específico. (Herdado de CollectionBase) |
| IList.IndexOf(Object) |
Procura o especificado Object e devolve o índice baseado em zero da primeira ocorrência dentro de todo CollectionBaseo . (Herdado de CollectionBase) |
| IList.Insert(Int32, Object) |
Insere um elemento no CollectionBase índice especificado. (Herdado de CollectionBase) |
| IList.IsFixedSize |
Obtém um valor que indica se o CollectionBase tem um tamanho fixo. (Herdado de CollectionBase) |
| IList.IsReadOnly |
Recebe um valor que indica se o CollectionBase é apenas de leitura. (Herdado de CollectionBase) |
| IList.Item[Int32] |
Obtém ou define o elemento no índice especificado. (Herdado de CollectionBase) |
| IList.Remove(Object) |
Remove a primeira ocorrência de um objeto específico do CollectionBase. (Herdado de CollectionBase) |
Métodos da Extensão
| Name | Description |
|---|---|
| AsParallel(IEnumerable) |
Permite a paralelização de uma consulta. |
| AsQueryable(IEnumerable) |
Converte um IEnumerable para um IQueryable. |
| Cast<TResult>(IEnumerable) |
Conjura os elementos de an IEnumerable para o tipo especificado. |
| OfType<TResult>(IEnumerable) |
Filtra os elementos de um IEnumerable com base num tipo especificado. |