CodeCatchClauseCollection 類別

定義

表示 CodeCatchClause 物件的集合。

public ref class CodeCatchClauseCollection : System::Collections::CollectionBase
public class CodeCatchClauseCollection : System.Collections.CollectionBase
[System.Runtime.InteropServices.ClassInterface(System.Runtime.InteropServices.ClassInterfaceType.AutoDispatch)]
[System.Runtime.InteropServices.ComVisible(true)]
[System.Serializable]
public class CodeCatchClauseCollection : System.Collections.CollectionBase
type CodeCatchClauseCollection = class
    inherit CollectionBase
[<System.Runtime.InteropServices.ClassInterface(System.Runtime.InteropServices.ClassInterfaceType.AutoDispatch)>]
[<System.Runtime.InteropServices.ComVisible(true)>]
[<System.Serializable>]
type CodeCatchClauseCollection = class
    inherit CollectionBase
Public Class CodeCatchClauseCollection
Inherits CollectionBase
繼承
CodeCatchClauseCollection
屬性

範例

下列範例示範如何使用 CodeCatchClauseCollection 類別方法。 此範例會建立 類別的新實例,並使用 方法將 語句加入集合、傳回其索引,以及在特定索引點加入或移除屬性。

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

// Adds a CodeCatchClause to the collection.
collection->Add( gcnew CodeCatchClause( "e" ) );

// Adds an array of CodeCatchClause objects to the collection.
array<CodeCatchClause^>^clauses = {gcnew CodeCatchClause,gcnew CodeCatchClause};
collection->AddRange( clauses );

// Adds a collection of CodeCatchClause objects to the collection.
CodeCatchClauseCollection^ clausesCollection = gcnew CodeCatchClauseCollection;
clausesCollection->Add( gcnew CodeCatchClause( "e",gcnew CodeTypeReference( System::ArgumentOutOfRangeException::typeid ) ) );
clausesCollection->Add( gcnew CodeCatchClause( "e" ) );
collection->AddRange( clausesCollection );

// Tests for the presence of a CodeCatchClause in the 
// collection, and retrieves its index if it is found.
CodeCatchClause^ testClause = gcnew CodeCatchClause( "e" );
int itemIndex = -1;
if ( collection->Contains( testClause ) )
   itemIndex = collection->IndexOf( testClause );

// Copies the contents of the collection beginning at index 0 to the specified CodeCatchClause array.
// 'clauses' is a CodeCatchClause array.
collection->CopyTo( clauses, 0 );

// Retrieves the count of the items in the collection.
int collectionCount = collection->Count;

// Inserts a CodeCatchClause at index 0 of the collection.
collection->Insert( 0, gcnew CodeCatchClause( "e" ) );

// Removes the specified CodeCatchClause from the collection.
CodeCatchClause^ clause = gcnew CodeCatchClause( "e" );
collection->Remove( clause );

// Removes the CodeCatchClause at index 0.
collection->RemoveAt( 0 );
// Creates an empty CodeCatchClauseCollection.
CodeCatchClauseCollection collection = new CodeCatchClauseCollection();

// Adds a CodeCatchClause to the collection.
collection.Add( new CodeCatchClause("e") );

// Adds an array of CodeCatchClause objects to the collection.
CodeCatchClause[] clauses = { new CodeCatchClause(), new CodeCatchClause() };
collection.AddRange( clauses );

// Adds a collection of CodeCatchClause objects to the collection.
CodeCatchClauseCollection clausesCollection = new CodeCatchClauseCollection();
clausesCollection.Add( new CodeCatchClause("e", new CodeTypeReference(typeof(System.ArgumentOutOfRangeException))) );
clausesCollection.Add( new CodeCatchClause("e") );
collection.AddRange( clausesCollection );

// Tests for the presence of a CodeCatchClause in the
// collection, and retrieves its index if it is found.
CodeCatchClause testClause = new CodeCatchClause("e");
int itemIndex = -1;
if( collection.Contains( testClause ) )
    itemIndex = collection.IndexOf( testClause );

// Copies the contents of the collection beginning at index 0 to the specified CodeCatchClause array.
// 'clauses' is a CodeCatchClause array.
collection.CopyTo( clauses, 0 );

// Retrieves the count of the items in the collection.
int collectionCount = collection.Count;

// Inserts a CodeCatchClause at index 0 of the collection.
collection.Insert( 0, new CodeCatchClause("e") );

// Removes the specified CodeCatchClause from the collection.
CodeCatchClause clause = new CodeCatchClause("e");
collection.Remove( clause );

// Removes the CodeCatchClause at index 0.
collection.RemoveAt(0);
' Creates an empty CodeCatchClauseCollection.
Dim collection As New CodeCatchClauseCollection()

' Adds a CodeCatchClause to the collection.
collection.Add(New CodeCatchClause("e"))

' Adds an array of CodeCatchClause objects to the collection.
Dim clauses As CodeCatchClause() = {New CodeCatchClause(), New CodeCatchClause()}
collection.AddRange(clauses)

' Adds a collection of CodeCatchClause objects to the collection.
Dim clausesCollection As New CodeCatchClauseCollection()
clausesCollection.Add(New CodeCatchClause("e", New CodeTypeReference(GetType(System.ArgumentOutOfRangeException))))
clausesCollection.Add(New CodeCatchClause("e"))
collection.AddRange(clausesCollection)

' Tests for the presence of a CodeCatchClause in the 
' collection, and retrieves its index if it is found.
Dim testClause As New CodeCatchClause("e")
Dim itemIndex As Integer = -1
If collection.Contains(testClause) Then
    itemIndex = collection.IndexOf(testClause)
End If

' Copies the contents of the collection beginning at index 0 to the specified CodeCatchClause array.
' 'clauses' is a CodeCatchClause array.
collection.CopyTo(clauses, 0)

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

' Inserts a CodeCatchClause at index 0 of the collection.
collection.Insert(0, New CodeCatchClause("e"))

' Removes the specified CodeCatchClause from the collection.
Dim clause As New CodeCatchClause("e")
collection.Remove(clause)

' Removes the CodeCatchClause at index 0.
collection.RemoveAt(0)

備註

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

建構函式

CodeCatchClauseCollection()

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

CodeCatchClauseCollection(CodeCatchClause[])

初始化 CodeCatchClauseCollection 類別 (含有 CodeCatchClause 物件的指定陣列) 的新執行個體。

CodeCatchClauseCollection(CodeCatchClauseCollection)

初始化 CodeCatchClauseCollection 類別 (含有指定來源集合的元素) 的新執行個體。

屬性

Capacity

取得或設定 CollectionBase 可包含的項目數目。

(繼承來源 CollectionBase)
Count

取得 CollectionBase 執行個體中包含的元素數目。 這個屬性無法覆寫。

(繼承來源 CollectionBase)
InnerList

取得包含 ArrayList 執行個體中之元素清單的 CollectionBase

(繼承來源 CollectionBase)
Item[Int32]

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

List

取得包含 IList 執行個體中之元素清單的 CollectionBase

(繼承來源 CollectionBase)

方法

Add(CodeCatchClause)

將指定的 CodeCatchClause 物件加入至集合。

AddRange(CodeCatchClause[])

將指定的 CodeCatchClause 陣列元素複製到集合的末端。

AddRange(CodeCatchClauseCollection)

將另一個 CodeCatchClauseCollection 物件的內容複製到集合的結尾。

Clear()

CollectionBase 執行個體移除所有的物件。 無法覆寫這個方法。

(繼承來源 CollectionBase)
Contains(CodeCatchClause)

取得值,這個值表示集合是否包含指定的 CodeCatchClause 物件。

CopyTo(CodeCatchClause[], Int32)

將集合物件複製到指定索引開頭的一維 Array 執行個體。

Equals(Object)

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

(繼承來源 Object)
GetEnumerator()

傳回可逐一查看 CollectionBase 執行個體的列舉值。

(繼承來源 CollectionBase)
GetHashCode()

做為預設雜湊函式。

(繼承來源 Object)
GetType()

取得目前執行個體的 Type

(繼承來源 Object)
IndexOf(CodeCatchClause)

取得集合中指定之 CodeCatchClause 物件的索引 (如果它存在於集合中的話)。

Insert(Int32, CodeCatchClause)

將指定的 CodeCatchClause 物件插入至集合中所指定索引處。

MemberwiseClone()

建立目前 Object 的淺層複製。

(繼承來源 Object)
OnClear()

在清除 CollectionBase 執行個體的內容之後,執行額外的自訂處理序。

(繼承來源 CollectionBase)
OnClearComplete()

在清除 CollectionBase 執行個體的內容後,執行額外的自訂處理序。

(繼承來源 CollectionBase)
OnInsert(Int32, Object)

在將新的元素插入至 CollectionBase 執行個體前,執行額外的自訂處理序。

(繼承來源 CollectionBase)
OnInsertComplete(Int32, Object)

在將新的元素插入至 CollectionBase 執行個體後,執行額外的自訂處理序。

(繼承來源 CollectionBase)
OnRemove(Int32, Object)

當從 CollectionBase 執行個體移除元素時,執行額外的自訂處理序。

(繼承來源 CollectionBase)
OnRemoveComplete(Int32, Object)

在從 CollectionBase 執行個體移除元素後,執行額外的自訂處理序。

(繼承來源 CollectionBase)
OnSet(Int32, Object, Object)

CollectionBase 執行個體中設定數值前,執行額外的自訂處理序。

(繼承來源 CollectionBase)
OnSetComplete(Int32, Object, Object)

CollectionBase 執行個體中設定數值後,執行額外的自訂處理序。

(繼承來源 CollectionBase)
OnValidate(Object)

當驗證數值時,執行額外的自訂處理序。

(繼承來源 CollectionBase)
Remove(CodeCatchClause)

從集合中移除指定的 CodeCatchClause 物件。

RemoveAt(Int32)

移除 CollectionBase 執行個體之指定索引的元素。 這個方法不可覆寫。

(繼承來源 CollectionBase)
ToString()

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

(繼承來源 Object)

明確介面實作

ICollection.CopyTo(Array, Int32)

從目標陣列的指定索引開始,將整個 CollectionBase 複製到相容的一維 Array

(繼承來源 CollectionBase)
ICollection.IsSynchronized

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

(繼承來源 CollectionBase)
ICollection.SyncRoot

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

(繼承來源 CollectionBase)
IList.Add(Object)

將物件加入至 CollectionBase 的末端。

(繼承來源 CollectionBase)
IList.Contains(Object)

判斷 CollectionBase 是否包含特定項目。

(繼承來源 CollectionBase)
IList.IndexOf(Object)

搜尋指定的 Object,並傳回在整個 CollectionBase 中第一個符合項目之以零為起始的索引。

(繼承來源 CollectionBase)
IList.Insert(Int32, Object)

將項目插入至 CollectionBase 中指定的索引位置。

(繼承來源 CollectionBase)
IList.IsFixedSize

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

(繼承來源 CollectionBase)
IList.IsReadOnly

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

(繼承來源 CollectionBase)
IList.Item[Int32]

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

(繼承來源 CollectionBase)
IList.Remove(Object)

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

(繼承來源 CollectionBase)

擴充方法

Cast<TResult>(IEnumerable)

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

OfType<TResult>(IEnumerable)

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

AsParallel(IEnumerable)

啟用查詢的平行化作業。

AsQueryable(IEnumerable)

IEnumerable 轉換成 IQueryable

適用於

另請參閱