CodeNamespaceImportCollection 類別

定義

表示 CodeNamespaceImport 物件的集合。

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 ICollection
    interface IEnumerable
    interface 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
Public Class CodeNamespaceImportCollection
Implements IList
繼承
CodeNamespaceImportCollection
屬性
實作

範例

下列範例示範 類別的 CodeNamespaceImportCollection 一些成員。 此範例會初始化 類別的新實例、將物件加入 CodeNamespaceImport 其中,並取得集合中的物件總數。

// 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

備註

CodeNamespaceImportCollection 類別提供可用來儲存一組 CodeNamespaceImport 物件的簡單集合物件。

建構函式

CodeNamespaceImportCollection()

初始化 CodeNamespaceImportCollection 類別的新執行個體。

屬性

Count

取得集合中的命名空間 (Namespace) 數目。

Item[Int32]

取得或設定位於集合中所指定索引處的 CodeNamespaceImport 物件。

方法

Add(CodeNamespaceImport)

CodeNamespaceImport 物件加入至集合。

AddRange(CodeNamespaceImport[])

將一組 CodeNamespaceImport 物件加入至集合中。

Clear()

清除成員的集合。

Equals(Object)

判斷指定的物件是否等於目前的物件。

(繼承來源 Object)
GetEnumerator()

取得列舉集合成員的列舉值。

GetHashCode()

做為預設雜湊函式。

(繼承來源 Object)
GetType()

取得目前執行個體的 Type

(繼承來源 Object)
MemberwiseClone()

建立目前 Object 的淺層複製。

(繼承來源 Object)
ToString()

傳回代表目前物件的字串。

(繼承來源 Object)

明確介面實作

ICollection.CopyTo(Array, Int32)

從特定的 ICollection 索引開始,將 Array 的項目複製到 Array

ICollection.Count

取得 ICollection 中所包含的項目數。

ICollection.IsSynchronized

取得值,這個值表示對 ICollection 的存取是否同步 (安全執行緒)。

ICollection.SyncRoot

取得可用以同步存取 ICollection 的物件。

IEnumerable.GetEnumerator()

傳回可逐一查看集合的列舉值。

IList.Add(Object)

將物件加入 IList

IList.Clear()

IList 中移除所有項目。

IList.Contains(Object)

判斷 IList 是否包含特定值。

IList.IndexOf(Object)

判斷 IList 中指定項目的索引。

IList.Insert(Int32, Object)

將項目插入位於指定位置的 IList

IList.IsFixedSize

取得值,指出 IList 是否有固定的大小。

IList.IsReadOnly

取得值,指出 IList 是否唯讀。

IList.Item[Int32]

在指定的索引位置上取得或設定項目。

IList.Remove(Object)

IList 移除特定物件之第一個符合的元素。

IList.RemoveAt(Int32)

移除 IList 之指定索引處的項目。

擴充方法

Cast<TResult>(IEnumerable)

IEnumerable 的項目轉換成指定的型別。

OfType<TResult>(IEnumerable)

根據指定的型別來篩選 IEnumerable 的項目。

AsParallel(IEnumerable)

啟用查詢的平行化作業。

AsQueryable(IEnumerable)

IEnumerable 轉換成 IQueryable

適用於

另請參閱