CodeNamespaceImportCollection CodeNamespaceImportCollection CodeNamespaceImportCollection CodeNamespaceImportCollection Class


表示 CodeNamespaceImport 物件的集合。Represents a collection of CodeNamespaceImport objects.

public ref class CodeNamespaceImportCollection : System::Collections::IList
public class CodeNamespaceImportCollection : System.Collections.IList
type CodeNamespaceImportCollection = class
    interface IList
    interface ICollection
    interface IEnumerable
Public Class CodeNamespaceImportCollection
Implements IList


下列範例示範一些成員CodeNamespaceImportCollection類別。The following example demonstrates some of the members of the CodeNamespaceImportCollection class. 此範例會初始化類別的新執行個體,新增CodeNamespaceImport物件,並取得集合中的物件總數。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")}

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


CodeNamespaceImportCollection 類別提供可用來儲存一組 CodeNamespaceImport 物件的簡單集合物件。The CodeNamespaceImportCollection class provides a simple collection object that can be used to store a set of CodeNamespaceImport objects.


CodeNamespaceImportCollection() CodeNamespaceImportCollection() CodeNamespaceImportCollection() CodeNamespaceImportCollection()

初始化 CodeNamespaceImportCollection 類別的新執行個體。Initializes a new instance of the CodeNamespaceImportCollection class.


Count Count Count Count

取得集合中的命名空間 (Namespace) 數目。Gets the number of namespaces in the collection.

Item[Int32] Item[Int32] Item[Int32] Item[Int32]

取得或設定位於集合中所指定索引處的 CodeNamespaceImport 物件。Gets or sets the CodeNamespaceImport object at the specified index in the collection.


Add(CodeNamespaceImport) Add(CodeNamespaceImport) Add(CodeNamespaceImport) Add(CodeNamespaceImport)

CodeNamespaceImport 物件加入至集合。Adds a CodeNamespaceImport object to the collection.

AddRange(CodeNamespaceImport[]) AddRange(CodeNamespaceImport[]) AddRange(CodeNamespaceImport[]) AddRange(CodeNamespaceImport[])

將一組 CodeNamespaceImport 物件加入至集合中。Adds a set of CodeNamespaceImport objects to the collection.

Clear() Clear() Clear() Clear()

清除成員的集合。Clears the collection of members.

Equals(Object) Equals(Object) Equals(Object) Equals(Object)

判斷指定的物件是否等於目前的物件。Determines whether the specified object is equal to the current object.

(Inherited from Object)
GetEnumerator() GetEnumerator() GetEnumerator() GetEnumerator()

取得列舉集合成員的列舉值。Gets an enumerator that enumerates the collection members.

GetHashCode() GetHashCode() GetHashCode() GetHashCode()

做為預設雜湊函式。Serves as the default hash function.

(Inherited from Object)
GetType() GetType() GetType() GetType()

取得目前執行個體的 TypeGets the Type of the current instance.

(Inherited from Object)
MemberwiseClone() MemberwiseClone() MemberwiseClone() MemberwiseClone()

建立目前 Object 的淺層複本 (Shallow Copy)。Creates a shallow copy of the current Object.

(Inherited from Object)
ToString() ToString() ToString() ToString()

傳回代表目前物件的字串。Returns a string that represents the current object.

(Inherited from Object)


ICollection.CopyTo(Array, Int32) ICollection.CopyTo(Array, Int32) ICollection.CopyTo(Array, Int32) ICollection.CopyTo(Array, Int32)

從特定的 ICollection 索引開始,將 Array 的項目複製到 ArrayCopies the elements of the ICollection to an Array, starting at a particular Array index.

ICollection.Count ICollection.Count ICollection.Count ICollection.Count

取得 ICollection 中所包含的項目數。Gets the number of elements contained in the ICollection.

ICollection.IsSynchronized ICollection.IsSynchronized ICollection.IsSynchronized ICollection.IsSynchronized

取得值,這個值表示對 ICollection 的存取是否同步 (安全執行緒)。Gets a value indicating whether access to the ICollection is synchronized (thread safe).

ICollection.SyncRoot ICollection.SyncRoot ICollection.SyncRoot ICollection.SyncRoot

取得可用以同步存取 ICollection 的物件。Gets an object that can be used to synchronize access to the ICollection.

IEnumerable.GetEnumerator() IEnumerable.GetEnumerator() IEnumerable.GetEnumerator() IEnumerable.GetEnumerator()

傳回可逐一查看集合的列舉值。Returns an enumerator that can iterate through a collection.

IList.Add(Object) IList.Add(Object) IList.Add(Object) IList.Add(Object)

將物件加入至 IListAdds an object to the IList.

IList.Clear() IList.Clear() IList.Clear() IList.Clear()

IList 中移除所有項目。Removes all items from the IList.

IList.Contains(Object) IList.Contains(Object) IList.Contains(Object) IList.Contains(Object)

判斷 IList 是否包含特定值。Determines whether the IList contains a specific value.

IList.IndexOf(Object) IList.IndexOf(Object) IList.IndexOf(Object) IList.IndexOf(Object)

判斷 IList 中指定項目的索引。Determines the index of a specific item in the IList.

IList.Insert(Int32, Object) IList.Insert(Int32, Object) IList.Insert(Int32, Object) IList.Insert(Int32, Object)

將項目插入位於指定位置的 IListInserts an item in the IList at the specified position.

IList.IsFixedSize IList.IsFixedSize IList.IsFixedSize IList.IsFixedSize

取得值,指出 IList 是否有固定的大小。Gets a value indicating whether the IList has a fixed size.

IList.IsReadOnly IList.IsReadOnly IList.IsReadOnly IList.IsReadOnly

取得值,指出 IList 是否唯讀。Gets a value indicating whether the IList is read-only.

IList.Item[Int32] IList.Item[Int32] IList.Item[Int32] IList.Item[Int32]

在指定的索引位置上取得或設定項目。Gets or sets the element at the specified index.

IList.Remove(Object) IList.Remove(Object) IList.Remove(Object) IList.Remove(Object)

IList 移除特定物件之第一個符合的元素。Removes the first occurrence of a specific object from the IList.

IList.RemoveAt(Int32) IList.RemoveAt(Int32) IList.RemoveAt(Int32) IList.RemoveAt(Int32)

移除 IList 中指定之索引處的項目。Removes the element at the specified index of the IList.

Extension Methods

Cast<TResult>(IEnumerable) Cast<TResult>(IEnumerable) Cast<TResult>(IEnumerable) Cast<TResult>(IEnumerable)

IEnumerable 的項目轉換成指定的型別。Casts the elements of an IEnumerable to the specified type.

OfType<TResult>(IEnumerable) OfType<TResult>(IEnumerable) OfType<TResult>(IEnumerable) OfType<TResult>(IEnumerable)

根據指定的型別來篩選 IEnumerable 的項目。Filters the elements of an IEnumerable based on a specified type.

AsParallel(IEnumerable) AsParallel(IEnumerable) AsParallel(IEnumerable) AsParallel(IEnumerable)

啟用查詢的平行化作業。Enables parallelization of a query.

AsQueryable(IEnumerable) AsQueryable(IEnumerable) AsQueryable(IEnumerable) AsQueryable(IEnumerable)

將轉換IEnumerableIQueryableConverts an IEnumerable to an IQueryable.