Uređivanje

Dijeli putem


CodeNamespaceImportCollection Class

Definition

Represents a collection of CodeNamespaceImport objects.

public ref class CodeNamespaceImportCollection : System::Collections::IList
public class CodeNamespaceImportCollection : System.Collections.IList
[System.Runtime.InteropServices.ClassInterface(System.Runtime.InteropServices.ClassInterfaceType.AutoDispatch)]
[System.Runtime.InteropServices.ComVisible(true)]
[System.Serializable]
public class CodeNamespaceImportCollection : System.Collections.IList
type CodeNamespaceImportCollection = class
    interface IList
    interface ICollection
    interface IEnumerable
[<System.Runtime.InteropServices.ClassInterface(System.Runtime.InteropServices.ClassInterfaceType.AutoDispatch)>]
[<System.Runtime.InteropServices.ComVisible(true)>]
[<System.Serializable>]
type CodeNamespaceImportCollection = class
    interface IList
    interface ICollection
    interface IEnumerable
type CodeNamespaceImportCollection = class
    interface ICollection
    interface IEnumerable
    interface IList
Public Class CodeNamespaceImportCollection
Implements IList
Inheritance
CodeNamespaceImportCollection
Attributes
Implements

Examples

The following example demonstrates some of the members of the CodeNamespaceImportCollection class. The example initializes a new instance of the class, adds CodeNamespaceImport objects to it, and gets the total number of objects in the collection.

// Creates an empty CodeNamespaceImportCollection.
CodeNamespaceImportCollection^ collection =
   gcnew CodeNamespaceImportCollection;

// Adds a CodeNamespaceImport to the collection.
collection->Add( gcnew CodeNamespaceImport( "System" ) );

// Adds an array of CodeNamespaceImport objects to the collection.
array<CodeNamespaceImport^>^ Imports = {
   gcnew CodeNamespaceImport( "System" ),
   gcnew CodeNamespaceImport( "System.Drawing" )};
collection->AddRange( Imports );

// Retrieves the count of the items in the collection.
int collectionCount = collection->Count;
// Creates an empty CodeNamespaceImportCollection.
CodeNamespaceImportCollection collection =
    new CodeNamespaceImportCollection();            			

// Adds a CodeNamespaceImport to the collection.
collection.Add( new CodeNamespaceImport("System") );

// Adds an array of CodeNamespaceImport objects to the collection.
CodeNamespaceImport[] Imports = {
        new CodeNamespaceImport("System"),
        new CodeNamespaceImport("System.Drawing") };
collection.AddRange( Imports );

// Retrieves the count of the items in the collection.
int collectionCount = collection.Count;
' Creates an empty CodeNamespaceImportCollection.
Dim collection As New CodeNamespaceImportCollection()

' Adds a CodeNamespaceImport to the collection.
collection.Add(New CodeNamespaceImport("System"))

' Adds an array of CodeNamespaceImport objects to the collection.
Dim [Imports] As CodeNamespaceImport() = _
    {New CodeNamespaceImport("System"), _
    New CodeNamespaceImport("System.Drawing")}
collection.AddRange([Imports])

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

Remarks

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

Constructors

CodeNamespaceImportCollection()

Initializes a new instance of the CodeNamespaceImportCollection class.

Properties

Count

Gets the number of namespaces in the collection.

Item[Int32]

Gets or sets the CodeNamespaceImport object at the specified index in the collection.

Methods

Add(CodeNamespaceImport)

Adds a CodeNamespaceImport object to the collection.

AddRange(CodeNamespaceImport[])

Adds a set of CodeNamespaceImport objects to the collection.

Clear()

Clears the collection of members.

Equals(Object)

Determines whether the specified object is equal to the current object.

(Inherited from Object)
GetEnumerator()

Gets an enumerator that enumerates the collection members.

GetHashCode()

Serves as the default hash function.

(Inherited from Object)
GetType()

Gets the Type of the current instance.

(Inherited from Object)
MemberwiseClone()

Creates a shallow copy of the current Object.

(Inherited from Object)
ToString()

Returns a string that represents the current object.

(Inherited from Object)

Explicit Interface Implementations

ICollection.CopyTo(Array, Int32)

Copies the elements of the ICollection to an Array, starting at a particular Array index.

ICollection.Count

Gets the number of elements contained in the ICollection.

ICollection.IsSynchronized

Gets a value indicating whether access to the ICollection is synchronized (thread safe).

ICollection.SyncRoot

Gets an object that can be used to synchronize access to the ICollection.

IEnumerable.GetEnumerator()

Returns an enumerator that can iterate through a collection.

IList.Add(Object)

Adds an object to the IList.

IList.Clear()

Removes all items from the IList.

IList.Contains(Object)

Determines whether the IList contains a specific value.

IList.IndexOf(Object)

Determines the index of a specific item in the IList.

IList.Insert(Int32, Object)

Inserts an item in the IList at the specified position.

IList.IsFixedSize

Gets a value indicating whether the IList has a fixed size.

IList.IsReadOnly

Gets a value indicating whether the IList is read-only.

IList.Item[Int32]

Gets or sets the element at the specified index.

IList.Remove(Object)

Removes the first occurrence of a specific object from the IList.

IList.RemoveAt(Int32)

Removes the element at the specified index of the IList.

Extension Methods

Cast<TResult>(IEnumerable)

Casts the elements of an IEnumerable to the specified type.

OfType<TResult>(IEnumerable)

Filters the elements of an IEnumerable based on a specified type.

AsParallel(IEnumerable)

Enables parallelization of a query.

AsQueryable(IEnumerable)

Converts an IEnumerable to an IQueryable.

Applies to

See also