ActivityCollection 類別

定義

警告

此 API 現已淘汰。

形成 ICollection 型別其強型別 Activity 的模型。Models a strongly typed ICollection of type Activity.

public ref class ActivityCollection sealed : System::Collections::Generic::List<System::Workflow::ComponentModel::Activity ^>, System::Collections::Generic::ICollection<System::Workflow::ComponentModel::Activity ^>, System::Collections::Generic::IEnumerable<System::Workflow::ComponentModel::Activity ^>, System::Collections::Generic::IList<System::Workflow::ComponentModel::Activity ^>
[System.Obsolete("The System.Workflow.* types are deprecated.  Instead, please use the new types from System.Activities.*")]
public sealed class ActivityCollection : System.Collections.Generic.List<System.Workflow.ComponentModel.Activity>, System.Collections.Generic.ICollection<System.Workflow.ComponentModel.Activity>, System.Collections.Generic.IEnumerable<System.Workflow.ComponentModel.Activity>, System.Collections.Generic.IList<System.Workflow.ComponentModel.Activity>
type ActivityCollection = class
    inherit List<Activity>
    interface IList<Activity>
    interface ICollection<Activity>
    interface seq<Activity>
    interface IEnumerable
    interface IList
    interface ICollection
Public NotInheritable Class ActivityCollection
Inherits List(Of Activity)
Implements ICollection(Of Activity), IEnumerable(Of Activity), IList(Of Activity)
繼承
ActivityCollection
屬性
實作

範例

下列範例顯示存取 ActivityCollection,它是包含所有子活動的複合活動類別的成員。The following example shows access of the ActivityCollection which is the member of a composite activity class containing all child activities. 這個程式碼範例是 ThrowWorkflow.cs 檔案中<使用擲回 SDK 範例>的一部分。This code example is part of the Using Throw SDK Sample and is from the ThrowWorkflow.cs file. 如需詳細資訊,請參閱使用 ThrowActivity 活動For more information, see Using the ThrowActivity Activity.

this.CanModifyActivities = true;
System.Workflow.ComponentModel.ActivityBind activitybind1 = new System.Workflow.ComponentModel.ActivityBind();
this.throwActivity1 = new System.Workflow.ComponentModel.ThrowActivity();
activitybind1.Name = "ThrowWorkflow";
activitybind1.Path = "ThrownException";
// 
// throwActivity1
// 
this.throwActivity1.Name = "throwActivity1";
this.throwActivity1.SetBinding(System.Workflow.ComponentModel.ThrowActivity.FaultProperty, ((System.Workflow.ComponentModel.ActivityBind)(activitybind1)));
// 
// ThrowWorkflow
// 
this.Activities.Add(this.throwActivity1);
this.Name = "ThrowWorkflow";
this.CanModifyActivities = false;
Me.CanModifyActivities = True
Dim activitybind1 As New System.Workflow.ComponentModel.ActivityBind()
Me.throwActivity1 = New System.Workflow.ComponentModel.ThrowActivity()
activitybind1.Name = "ThrowWorkflow"
activitybind1.Path = "ThrownException"
' 
' throwActivity1
' 
Me.throwActivity1.Name = "throwActivity1"
Me.throwActivity1.SetBinding(System.Workflow.ComponentModel.ThrowActivity.FaultProperty, activitybind1)
' 
' ThrowWorkflow
' 
Me.Activities.Add(Me.throwActivity1)
Me.Name = "ThrowWorkflow"
Me.CanModifyActivities = False

備註

注意

此資料討論已被汰換的類型及命名空間。This material discusses types and namespaces that are obsolete. 如需詳細資訊,請參閱 Windows Workflow Foundation 4.5 中即將淘汰的類型For more information, see Deprecated Types in Windows Workflow Foundation 4.5.

這個類別用於表示 CompositeActivity 的子活動清單。This class is used to represent the list of child activities for a CompositeActivity.

注意

請只呼叫衍生自 IList<T> 而非 List<T> 的方法,例如使用 Add 來加入活動而非 AddRangeOnly call methods derived from IList<T> and not List<T>, such as using Add to add activities instead of AddRange. 呼叫衍生自 List<T> 的方法會產生非預期的結果。Calling methods derived from List<T> will have unexpected consequences.

建構函式

ActivityCollection(Activity)

初始化 ActivityCollection 類別的新執行個體,這會初始化 Activity 的擁有者。Initializes a new instance of the ActivityCollection class, initializing an owner Activity.

屬性

Capacity

在不需要調整大小之下,取得或設定內部資料結構可以保存的項目總數。Gets or sets the total number of elements the internal data structure can hold without resizing.

(繼承來源 List<T>)
Count

取得 ICollection 的成員數目。Gets the number of members of the ICollection.

Item[Int32]

根據索引取得或設定 ICollection 中的活動。Gets or sets the activity in the ICollection based on the index.

Item[String]

根據為唯一索引鍵的字串取得 ICollection 中的活動。Gets the activity in the ICollection based on the string which is a unique key.

方法

Add(Activity)

Activity 新增至 ICollectionAdds the Activity to the ICollection.

Add(T)

將物件加入至 List<T> 的末端。Adds an object to the end of the List<T>.

(繼承來源 List<T>)
AddRange(IEnumerable<T>)

將特定集合的項目加入至 List<T> 的結尾。Adds the elements of the specified collection to the end of the List<T>.

(繼承來源 List<T>)
AsReadOnly()

傳回目前集合的唯讀 ReadOnlyCollection<T> 包裝函式。Returns a read-only ReadOnlyCollection<T> wrapper for the current collection.

(繼承來源 List<T>)
BinarySearch(Int32, Int32, T, IComparer<T>)

使用指定的比較子在已經過排序之 List<T> 內,搜尋某範圍的項目,並傳回該項目以零為起始的索引。Searches a range of elements in the sorted List<T> for an element using the specified comparer and returns the zero-based index of the element.

(繼承來源 List<T>)
BinarySearch(T)

使用預設的比較子並傳回項目以零為起始的索引,來搜尋項目之整個排序的 List<T>Searches the entire sorted List<T> for an element using the default comparer and returns the zero-based index of the element.

(繼承來源 List<T>)
BinarySearch(T, IComparer<T>)

使用指定的比較子並傳回項目以零為起始的索引,來搜尋項目之整個排序的 List<T>Searches the entire sorted List<T> for an element using the specified comparer and returns the zero-based index of the element.

(繼承來源 List<T>)
Clear()

Activity 中移除每個 ICollectionRemoves every Activity from the ICollection.

Contains(Activity)

提供測試 ActivityICollection 的成員資格。Provides a test for membership of the Activity in the ICollection.

Contains(T)

判斷某項目是否在 List<T> 中。Determines whether an element is in the List<T>.

(繼承來源 List<T>)
ConvertAll<TOutput>(Converter<T,TOutput>)

將目前 List<T> 中的項目轉換成另一個類型,並傳回包含轉換過的項目清單。Converts the elements in the current List<T> to another type, and returns a list containing the converted elements.

(繼承來源 List<T>)
CopyTo(Int32, T[], Int32, Int32)

從目標陣列的指定索引處開始,將項目範圍從 List<T> 複製到相容的一維陣列。Copies a range of elements from the List<T> to a compatible one-dimensional array, starting at the specified index of the target array.

(繼承來源 List<T>)
CopyTo(T[])

從目標陣列的開頭開始,將整個 List<T> 複製到相容的一維陣列。Copies the entire List<T> to a compatible one-dimensional array, starting at the beginning of the target array.

(繼承來源 List<T>)
CopyTo(T[], Int32)

從目標陣列的指定索引處開始,將整個 List<T> 複製到相容的一維陣列中。Copies the entire List<T> to a compatible one-dimensional array, starting at the specified index of the target array.

(繼承來源 List<T>)
Equals(Object)

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

(繼承來源 Object)
Exists(Predicate<T>)

判斷 List<T> 是否包含符合指定之述詞 (Predicate) 所定義之條件的元素。Determines whether the List<T> contains elements that match the conditions defined by the specified predicate.

(繼承來源 List<T>)
Find(Predicate<T>)

搜尋符合指定之述詞所定義的條件之元素,並傳回整個 List<T> 內第一個相符的項目。Searches for an element that matches the conditions defined by the specified predicate, and returns the first occurrence within the entire List<T>.

(繼承來源 List<T>)
FindAll(Predicate<T>)

擷取符合指定之述詞所定義的條件之所有項目。Retrieves all the elements that match the conditions defined by the specified predicate.

(繼承來源 List<T>)
FindIndex(Int32, Int32, Predicate<T>)

搜尋符合指定之述詞所定義的條件之項目,並傳回 List<T> 中從指定之索引開始,且包含指定之項目數目的項目範圍內第一個符合項目之以零為起始的索引。Searches for an element that matches the conditions defined by the specified predicate, and returns the zero-based index of the first occurrence within the range of elements in the List<T> that starts at the specified index and contains the specified number of elements.

(繼承來源 List<T>)
FindIndex(Int32, Predicate<T>)

搜尋符合指定之述詞所定義的條件之項目,並傳回 List<T> 內 (從指定之索引延伸到最後一個項目),於某項目範圍中第一次出現之以零為起始的索引。Searches for an element that matches the conditions defined by the specified predicate, and returns the zero-based index of the first occurrence within the range of elements in the List<T> that extends from the specified index to the last element.

(繼承來源 List<T>)
FindIndex(Predicate<T>)

搜尋符合指定之述詞所定義的條件之項目,並傳回整個 List<T> 內第一次出現之以零為起始的索引。Searches for an element that matches the conditions defined by the specified predicate, and returns the zero-based index of the first occurrence within the entire List<T>.

(繼承來源 List<T>)
FindLast(Predicate<T>)

搜尋符合指定之述詞所定義的條件之項目,並傳回整個 List<T> 內最後一個相符的項目。Searches for an element that matches the conditions defined by the specified predicate, and returns the last occurrence within the entire List<T>.

(繼承來源 List<T>)
FindLastIndex(Int32, Int32, Predicate<T>)

搜尋符合指定之述詞所定義的條件之項目,並傳回 List<T> 中包含指定之項目數目,且結束於指定之索引的項目範圍內最後一個符合項目之以零為起始的索引。Searches for an element that matches the conditions defined by the specified predicate, and returns the zero-based index of the last occurrence within the range of elements in the List<T> that contains the specified number of elements and ends at the specified index.

(繼承來源 List<T>)
FindLastIndex(Int32, Predicate<T>)

搜尋符合指定之述詞所定義的條件之項目,並傳回 List<T> 中從第一個項目延伸到指定之索引的項目範圍內,最後一個符合項目之以零為起始的索引。Searches for an element that matches the conditions defined by the specified predicate, and returns the zero-based index of the last occurrence within the range of elements in the List<T> that extends from the first element to the specified index.

(繼承來源 List<T>)
FindLastIndex(Predicate<T>)

搜尋符合指定之述詞所定義的條件之元素,並傳回整個 List<T> 內最後一個相符項目之以零起始的索引。Searches for an element that matches the conditions defined by the specified predicate, and returns the zero-based index of the last occurrence within the entire List<T>.

(繼承來源 List<T>)
ForEach(Action<T>)

List<T> 的每一個項目上執行指定之動作。Performs the specified action on each element of the List<T>.

(繼承來源 List<T>)
GetEnumerator()

實作 ICollection 的列舉介面。Implements an enumeration interface to the ICollection.

GetHashCode()

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

(繼承來源 Object)
GetRange(Int32, Int32)

為來源 List<T> 中的項目範圍建立淺層複本。Creates a shallow copy of a range of elements in the source List<T>.

(繼承來源 List<T>)
GetType()

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

(繼承來源 Object)
IndexOf(Activity)

取得 ActivityICollection 中的索引。Gets the index of the Activity in the ICollection.

IndexOf(T)

搜尋指定的物件,並傳回整個 List<T> 中第一個相符項目之以零起始的索引。Searches for the specified object and returns the zero-based index of the first occurrence within the entire List<T>.

(繼承來源 List<T>)
IndexOf(T, Int32)

List<T> 中從指定的索引開始到最後一個項目這段範圍內,搜尋指定的物件第一次出現的位置,並傳回其索引值 (索引以零起始)。Searches for the specified object and returns the zero-based index of the first occurrence within the range of elements in the List<T> that extends from the specified index to the last element.

(繼承來源 List<T>)
IndexOf(T, Int32, Int32)

List<T> 中從指定索引開始且包含指定個數項目的範圍內,搜尋指定的物件第一次出現的位置,並傳回其索引值 (索引以零為起始)。Searches for the specified object and returns the zero-based index of the first occurrence within the range of elements in the List<T> that starts at the specified index and contains the specified number of elements.

(繼承來源 List<T>)
Insert(Int32, Activity)

將項目插入在 ICollection 中的索引處。Inserts the item at the index in the ICollection.

Insert(Int32, T)

將項目插入至 List<T> 中指定的索引位置。Inserts an element into the List<T> at the specified index.

(繼承來源 List<T>)
InsertRange(Int32, IEnumerable<T>)

將集合的項目插入位於指定索引的 List<T> 中。Inserts the elements of a collection into the List<T> at the specified index.

(繼承來源 List<T>)
LastIndexOf(T)

搜尋指定的物件,並傳回整個 List<T> 中最後一個相符項目之以零起始的索引。Searches for the specified object and returns the zero-based index of the last occurrence within the entire List<T>.

(繼承來源 List<T>)
LastIndexOf(T, Int32)

List<T> 中從第一個項目開始到指定的索引這段範圍內,搜尋指定的物件最後一次出現的位置,並傳回其索引值 (索引以零起始)。Searches for the specified object and returns the zero-based index of the last occurrence within the range of elements in the List<T> that extends from the first element to the specified index.

(繼承來源 List<T>)
LastIndexOf(T, Int32, Int32)

List<T> 中包含指定個數項目且結尾位於指定索引的範圍內,搜尋指定的物件最後一次出現的位置,並傳回其索引值 (索引以零為起始)。Searches for the specified object and returns the zero-based index of the last occurrence within the range of elements in the List<T> that contains the specified number of elements and ends at the specified index.

(繼承來源 List<T>)
MemberwiseClone()

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

(繼承來源 Object)
Remove(Activity)

將在呼叫中指定的活動從 ICollection 移除。Removes the activity specified in the call from the ICollection.

Remove(T)

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

(繼承來源 List<T>)
RemoveAll(Predicate<T>)

移除符合指定的述詞所定義之條件的所有項目。Removes all the elements that match the conditions defined by the specified predicate.

(繼承來源 List<T>)
RemoveAt(Int32)

移除位於指定之 ActivityICollection 中的 indexRemoves the Activity in the ICollection at the specified index.

RemoveRange(Int32, Int32)

List<T> 移除的項目範圍。Removes a range of elements from the List<T>.

(繼承來源 List<T>)
Reverse()

反轉整個 List<T> 中項目的順序。Reverses the order of the elements in the entire List<T>.

(繼承來源 List<T>)
Reverse(Int32, Int32)

反向指定範圍中項目的順序。Reverses the order of the elements in the specified range.

(繼承來源 List<T>)
Sort()

使用預設的比較子來排序在整個 List<T> 中的項目。Sorts the elements in the entire List<T> using the default comparer.

(繼承來源 List<T>)
Sort(Comparison<T>)

使用指定的 Comparison<T> 來排序在整個 List<T> 中的項目。Sorts the elements in the entire List<T> using the specified Comparison<T>.

(繼承來源 List<T>)
Sort(IComparer<T>)

使用指定的比較子來排序在整個 List<T> 中的項目。Sorts the elements in the entire List<T> using the specified comparer.

(繼承來源 List<T>)
Sort(Int32, Int32, IComparer<T>)

使用指定的比較子對 List<T> 中某段範圍內的項目進行排序。Sorts the elements in a range of elements in List<T> using the specified comparer.

(繼承來源 List<T>)
ToArray()

List<T> 的項目複製到新的陣列。Copies the elements of the List<T> to a new array.

(繼承來源 List<T>)
ToString()

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

(繼承來源 Object)
TrimExcess()

將容量設為 List<T> 中項目的實際數目,如果該數目小於臨界值。Sets the capacity to the actual number of elements in the List<T>, if that number is less than a threshold value.

(繼承來源 List<T>)
TrueForAll(Predicate<T>)

判斷 List<T> 中的每一個項目是否符合指定之述詞所定義的條件。Determines whether every element in the List<T> matches the conditions defined by the specified predicate.

(繼承來源 List<T>)

事件

ListChanged

每當變更這個 ICollection 的內容時則引發。Raised whenever a change is made to the contents of this ICollection.

明確介面實作

ICollection.CopyTo(Array, Int32)

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

ICollection.IsSynchronized

取得值,指出 ICollection<T> 的存取是否同步,亦即是否執行緒安全。Gets a value that indicates whether access to the ICollection<T> is synchronized, that is thread-safe.

ICollection.SyncRoot

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

ICollection<Activity>.Add(Activity)

將物件加入至 IList 結尾的 IListAdds an object to the IList at the end of the IList.

ICollection<Activity>.Clear()

清除 IList 所有的活動。Clears all activities from the IList.

ICollection<Activity>.Contains(Activity)

取得值,指出 Object 是否為該集合的成員。Gets a value that indicates whether the Object is a member of the collection.

ICollection<Activity>.CopyTo(Activity[], Int32)

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

ICollection<Activity>.Count

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

ICollection<Activity>.IsReadOnly

取得值,這個值表示 IList 是否為唯讀。Gets a value that indicates whether the IList is read-only.

ICollection<Activity>.Remove(Activity)

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

ICollection<T>.IsReadOnly

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

(繼承來源 List<T>)
IEnumerable.GetEnumerator()

傳回能夠逐一查看基礎 IEnumeratorIListReturns an IEnumerator that iterates through the underlying IList.

IEnumerable<Activity>.GetEnumerator()

傳回逐一查看集合的列舉值。Returns an enumerator that iterates through the collection.

IEnumerable<T>.GetEnumerator()

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

(繼承來源 List<T>)
IList.Add(Object)

將物件加入至 IList 結尾的 IListAdds an object to the IList at the end of the IList.

IList.Clear()

移除 Activity 中的所有 ICollectionRemoves all Activity from the ICollection.

IList.Contains(Object)

取得值,指出 Object 是否為該集合的成員。Gets a value that indicates whether the Object is a member of the collection.

IList.IndexOf(Object)

取得基礎活動集合中 Object 的以零起始的索引。Gets the zero-based index of the Object in the underlying activities collection.

IList.Insert(Int32, Object)

Object 插入 IList 中指定之以零起始的索引處。Inserts an Object into the IList at the zero-based index specified.

IList.IsFixedSize

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

IList.IsReadOnly

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

IList.Item[Int32]

根據索引取得或設定 ICollection 中的活動。Gets or sets the activity in the ICollection based on the index.

IList.Remove(Object)

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

IList<Activity>.IndexOf(Activity)

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

IList<Activity>.Insert(Int32, Activity)

Object 插入 IList 中指定之以零起始的索引處。Inserts an Object into the IList at the zero-based index specified.

IList<Activity>.Item[Int32]

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

IList<Activity>.RemoveAt(Int32)

移除在指定索引處的 IList 項目。Removes the IList item at the specified index.

擴充方法

CopyToDataTable<T>(IEnumerable<T>)

根據輸入 DataTable 物件 (其中泛型參數 TDataRow) 傳回包含 IEnumerable<T> 物件複本的 DataRowReturns a DataTable that contains copies of the DataRow objects, given an input IEnumerable<T> object where the generic parameter T is DataRow.

CopyToDataTable<T>(IEnumerable<T>, DataTable, LoadOption)

根據輸入 DataRow 物件 (其中泛型參數 TDataTable),將 IEnumerable<T> 物件複製到指定的 DataRowCopies DataRow objects to the specified DataTable, given an input IEnumerable<T> object where the generic parameter T is DataRow.

CopyToDataTable<T>(IEnumerable<T>, DataTable, LoadOption, FillErrorEventHandler)

根據輸入 DataRow 物件 (其中泛型參數 TDataTable),將 IEnumerable<T> 物件複製到指定的 DataRowCopies DataRow objects to the specified DataTable, given an input IEnumerable<T> object where the generic parameter T is DataRow.

Cast<TResult>(IEnumerable)

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

OfType<TResult>(IEnumerable)

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

AsParallel(IEnumerable)

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

AsQueryable(IEnumerable)

IEnumerable 轉換成 IQueryableConverts an IEnumerable to an IQueryable.

Ancestors<T>(IEnumerable<T>)

傳回包含來源集合中每個節點祖系的項目集合。Returns a collection of elements that contains the ancestors of every node in the source collection.

Ancestors<T>(IEnumerable<T>, XName)

傳回包含來源集合中每個節點祖系的已篩選項目集合。Returns a filtered collection of elements that contains the ancestors of every node in the source collection. 集合中只會包含具有相符之 XName 的項目。Only elements that have a matching XName are included in the collection.

DescendantNodes<T>(IEnumerable<T>)

傳回來源集合中每個文件和項目之子代節點的集合。Returns a collection of the descendant nodes of every document and element in the source collection.

Descendants<T>(IEnumerable<T>)

傳回包含來源集合中每個項目和文件之子代項目的項目集合。Returns a collection of elements that contains the descendant elements of every element and document in the source collection.

Descendants<T>(IEnumerable<T>, XName)

傳回已篩選的項目集合,其中包含來源集合中每個項目和文件的子代項目。Returns a filtered collection of elements that contains the descendant elements of every element and document in the source collection. 集合中只會包含具有相符之 XName 的項目。Only elements that have a matching XName are included in the collection.

Elements<T>(IEnumerable<T>)

傳回來源集合中每個項目和文件的子項目集合。Returns a collection of the child elements of every element and document in the source collection.

Elements<T>(IEnumerable<T>, XName)

傳回來源集合中每個項目和文件的已篩選子項目集合。Returns a filtered collection of the child elements of every element and document in the source collection. 集合中只會包含具有相符之 XName 的項目。Only elements that have a matching XName are included in the collection.

InDocumentOrder<T>(IEnumerable<T>)

傳回包含來源集合中所有節點的節點集合,依據文件順序來排序。Returns a collection of nodes that contains all nodes in the source collection, sorted in document order.

Nodes<T>(IEnumerable<T>)

傳回來源集合中每個文件和項目的子節點集合。Returns a collection of the child nodes of every document and element in the source collection.

Remove<T>(IEnumerable<T>)

在來源集合中,從每一個節點的父節點移除這些節點。Removes every node in the source collection from its parent node.

適用於