CodeNamespaceImportCollection 類別
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
代表一組 CodeNamespaceImport 物件。
public ref 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
[<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 =
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 物件。
建構函式
| 名稱 | Description |
|---|---|
| CodeNamespaceImportCollection() |
初始化 CodeNamespaceImportCollection 類別的新執行個體。 |
屬性
| 名稱 | Description |
|---|---|
| Count |
取得集合中命名空間的數量。 |
| Item[Int32] |
取得或設定 CodeNamespaceImport 物件在集合中指定的索引位置。 |
方法
| 名稱 | Description |
|---|---|
| Add(CodeNamespaceImport) |
新增一個 CodeNamespaceImport 物件到集合中。 |
| AddRange(CodeNamespaceImport[]) |
將一組 CodeNamespaceImport 物件加入集合。 |
| Clear() |
清除成員集合。 |
| Equals(Object) |
判斷指定的物件是否等於目前的物件。 (繼承來源 Object) |
| GetEnumerator() |
會找一個普查員來列舉集合成員。 |
| GetHashCode() |
做為預設哈希函式。 (繼承來源 Object) |
| GetType() |
取得目前實例的 Type。 (繼承來源 Object) |
| MemberwiseClone() |
建立目前 Object的淺層複本。 (繼承來源 Object) |
| ToString() |
傳回表示目前 物件的字串。 (繼承來源 Object) |
明確介面實作
| 名稱 | Description |
|---|---|
| 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的元素。 |
擴充方法
| 名稱 | Description |
|---|---|
| AsParallel(IEnumerable) |
啟用查詢的平行處理。 |
| AsQueryable(IEnumerable) |
將 IEnumerable 轉換成 IQueryable。 |
| Cast<TResult>(IEnumerable) |
將 IEnumerable 的項目轉換成指定的型別。 |
| OfType<TResult>(IEnumerable) |
根據指定的型別篩選 IEnumerable 的專案。 |