CodeActivity<TResult> 類別

定義

使用在 Execute(CodeActivityContext) 方法中定義的命令式行為建立自訂活動的抽象類別,會授予變數、引數解析和擴充功能存取權。An abstract class for creating a custom activity with imperative behavior defined in the Execute(CodeActivityContext) method, giving access to variable and argument resolution and extensions.

generic <typename TResult>
public ref class CodeActivity abstract : System::Activities::Activity<TResult>
public abstract class CodeActivity<TResult> : System.Activities.Activity<TResult>
type CodeActivity<'Result> = class
    inherit Activity<'Result>
Public MustInherit Class CodeActivity(Of TResult)
Inherits Activity(Of TResult)

類型參數

TResult

活動傳回的結果。The result returned by the activity.

繼承
衍生

範例

下列範例將示範如何從 CodeActivity<TResult> 衍生類別。The following example shows how to derive a class from CodeActivity<TResult>.

public sealed class Add : CodeActivity<int>
{
    public InArgument<int> X { get; set; }
    public InArgument<int> Y { get; set; }

    protected override int Execute(CodeActivityContext context)
    {
        int x = X.Get(context);
        int y = Y.Get(context);

        return x + y;
    }
}

備註

衍生類別可以定義在類別的型別規範中所指定之型別的結果值。Derived classes can define a result value of the type specified in the type specifier of the class.

建構函式

CodeActivity<TResult>()

在衍生類別中實作時,建立衍生類別的執行個體。When implemented in a derived class, creates an instance of the derived class.

屬性

CacheId

取得工作流程定義範圍內的唯一快取識別碼。Gets the identifier of the cache that is unique within the scope of the workflow definition.

(繼承來源 Activity)
Constraints

取得 Constraint 活動的集合,這些活動可以設定為提供 Activity 的驗證。Gets a collection of Constraint activities that can be configured to provide validation for the Activity.

(繼承來源 Activity)
DisplayName

取得或設定選擇性的易記名稱,這個名稱會用於偵錯、驗證、例外狀況處理及追蹤。Gets or sets an optional friendly name that is used for debugging, validation, exception handling, and tracking.

(繼承來源 Activity)
Id

取得工作流程定義範圍內的唯一識別碼。Gets an identifier that is unique in the scope of the workflow definition.

(繼承來源 Activity)
Implementation

不支援。Not supported.

ImplementationVersion

取得或設定活動的實作版本。Gets or sets the implementation version of the activity.

ImplementationVersion

取得或設定所使用實作的版本。Gets or sets the version of the implementation used.

(繼承來源 Activity)
Result

取得或設定 Activity<TResult> 的結果引數。Gets or sets the result argument for the Activity<TResult>.

(繼承來源 Activity<TResult>)
ResultType

在衍生類別中實作時,取得活動 OutArgument 的型別。When implemented in a derived class, gets the type of an activity OutArgument.

(繼承來源 ActivityWithResult)

方法

CacheMetadata(ActivityMetadata)

未實作。Not implemented. 請改用 CacheMetadata(CodeActivityMetadata)Use CacheMetadata(CodeActivityMetadata) instead.

CacheMetadata(CodeActivityMetadata)

建立並驗證活動引數、變數、子活動和活動委派的描述。Creates and validates a description of the activity's arguments, variables, child activities, and activity delegates.

Equals(Object)

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

(繼承來源 Object)
Execute(CodeActivityContext)

在衍生類別中實作時,執行活動的執行。When implemented in a derived class, performs the execution of the activity.

GetHashCode()

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

(繼承來源 Object)
GetType()

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

(繼承來源 Object)
MemberwiseClone()

建立目前 Object 的淺層複製。Creates a shallow copy of the current Object.

(繼承來源 Object)
OnCreateDynamicUpdateMap(UpdateMapMetadata, Activity)

建立動態更新的對應時引發事件。Raises an event when creating a map for the dynamic update.

OnCreateDynamicUpdateMap(UpdateMapMetadata, Activity)

建立動態更新對應時引發事件。Raises an event when creating dynamic update map.

(繼承來源 Activity)
ShouldSerializeDisplayName()

指出是否應序列化 DisplayName 屬性。Indicates whether the DisplayName property should be serialized.

(繼承來源 Activity)
ToString()

傳回包含 的 和 的 。Returns a String that contains the Id and DisplayName of the Activity.

(繼承來源 Activity)

適用於