Este artigo foi traduzido por máquina. Para visualizar o arquivo em inglês, marque a caixa de seleção Inglês. Você também pode exibir o texto Em inglês em uma janela pop-up, movendo o ponteiro do mouse sobre o texto.
Tradução
Inglês

CodeTypeReferenceCollection Classe

Represents a collection of CodeTypeReference objects.

Namespace:  System.CodeDom
Assembly:  System (em System. dll)

[SerializableAttribute]
[ClassInterfaceAttribute(ClassInterfaceType.AutoDispatch)]
[ComVisibleAttribute(true)]
public class CodeTypeReferenceCollection : CollectionBase

The CodeTypeReferenceCollection class provides a simple collection object that can be used to store a set of CodeTypeReference objects.

// 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.
CodeTypeReferenceCollection collection = new 
    CodeTypeReferenceCollection();

// Adds a CodeTypeReference to the collection.
collection.Add(new CodeTypeReference(boolean.class.ToType()));

// Adds an array of CodeTypeReference objects to the collection.
CodeTypeReference references[] =  { new CodeTypeReference(boolean.
    class.ToType()), new CodeTypeReference(boolean.class.ToType()) };
collection.AddRange(references);
// Adds a collection of CodeTypeReference objects to the collection.
CodeTypeReferenceCollection referencesCollection = new 
    CodeTypeReferenceCollection();
referencesCollection.Add(new CodeTypeReference(boolean.class.ToType()));
referencesCollection.Add(new CodeTypeReference(boolean.class.ToType()));
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(boolean.
    class.ToType());
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.get_Count();

// Inserts a CodeTypeReference at index 0 of the collection.
collection.Insert(0, new CodeTypeReference(boolean.class.ToType()));

// Removes the specified CodeTypeReference from the collection.
CodeTypeReference reference = new CodeTypeReference(boolean.
    class.ToType());
collection.Remove(reference);

// Removes the CodeTypeReference at index 0.
collection.RemoveAt(0);


System.Object
  System.Collections.CollectionBase
    System.CodeDom.CodeTypeReferenceCollection

Quaisquer membros públicos estático (compartilhados na Visual Basic) desse tipo são Thread seguro. Não há garantia de que qualquer membro de instância seja isento de segmentos.

Contribuições da comunidade

ADICIONAR
Mostrar: