Activity<TResult> 类

定义

用于从预先存在的 Activity 对象创建复合活动的抽象基类,此类使用活动的类型说明符指定结果类型。An abstract base class used to create composite activities from pre-existing Activity objects, which specifies a result type using the activity's type specifier.

generic <typename TResult>
public ref class Activity abstract : System::Activities::ActivityWithResult
[System.ComponentModel.TypeConverter(typeof(System.Activities.XamlIntegration.ActivityWithResultConverter))]
public abstract class Activity<TResult> : System.Activities.ActivityWithResult
[<System.ComponentModel.TypeConverter(typeof(System.Activities.XamlIntegration.ActivityWithResultConverter))>]
type Activity<'Result> = class
    inherit ActivityWithResult
Public MustInherit Class Activity(Of TResult)
Inherits ActivityWithResult

类型参数

TResult

活动返回值的类型。The type of the return value of the activity.

继承
Activity<TResult>
派生
属性

示例

下面的示例演示如何从 Activity<TResult> 派生类。The following example shows how to derive a class from Activity<TResult>.

public sealed class AppendString : Activity<string>
{
    // Input argument.
    [RequiredArgument]
    public InArgument<string> Name { get; set; }

    public AppendString()
    {
        // Define the implementation of this activity.
        this.Implementation = () => new Assign<string>
        {
            Value = new LambdaValue<string>(ctx => Name.Get(ctx) + " says hello world"),
            To = new LambdaReference<string>(ctx => Result.Get(ctx)),
        };
    }
}

注解

Activity<TResult> 是活动类型层次结构中的基类。Activity<TResult> is the base class in the activity type hierarchy. 所有具有泛型类型定义的其他活动类型(例如 CodeActivity<TResult>NativeActivity<TResult>AsyncCodeActivity<TResult>DynamicActivity<TResult>)均是从此类派生的。All other activity types with generic type definitions such as CodeActivity<TResult>, NativeActivity<TResult>, AsyncCodeActivity<TResult>, and DynamicActivity<TResult> derive from this class.

构造函数

Activity<TResult>()

在派生类中实现时,创建派生类的新实例。When implemented in a derived class, creates a new 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

获取或设置返回包含执行逻辑的 Activity 的委托。Gets or sets the delegate that returns an Activity that contains the execution logic.

(继承自 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>.

ResultType

在派生类中实现时,获取 OutArgument 活动的类型。When implemented in a derived class, gets the type of an activity OutArgument.

(继承自 ActivityWithResult)

方法

CacheMetadata(ActivityMetadata)

创建并验证活动的自变量、变量、子活动和活动委托的说明。Creates and validates a description of the activity's arguments, variables, child activities, and activity delegates.

(继承自 Activity)
Equals(Object)

确定指定对象是否等于当前对象。Determines whether the specified object is equal to the current object.

(继承自 Object)
FromValue(TResult)

返回计算结果为给定值的 Activity<TResult> 表达式。Returns a Activity<TResult> expression that evaluates to the given value.

FromVariable(Variable)

返回计算结果为给定的 Activity<TResult>Variable 表达式。Returns a Activity<TResult> expression that evaluates to the given Variable.

FromVariable(Variable<TResult>)

返回计算结果为给定的 Activity<TResult>Variable<T> 表达式。Returns a Activity<TResult> expression that evaluates to the given Variable<T>.

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 dynamic update map.

(继承自 Activity)
ShouldSerializeDisplayName()

指示是否应序列化 DisplayName 属性。Indicates whether the DisplayName property should be serialized.

(继承自 Activity)
ToString()

返回包含 StringIdDisplayNameActivityReturns a String that contains the Id and DisplayName of the Activity.

(继承自 Activity)

运算符

Implicit(TResult to Activity<TResult>)

返回计算结果为给定值的 Activity<TResult> 表达式。Returns a Activity<TResult> expression that evaluates to the given value.

Implicit(Variable to Activity<TResult>)

返回计算结果为给定的 Activity<TResult>Variable 表达式。Returns a Activity<TResult> expression that evaluates to the given Variable.

Implicit(Variable<TResult> to Activity<TResult>)

返回计算结果为给定的 Activity<TResult>Variable<T> 表达式。Returns a Activity<TResult> expression that evaluates to the given Variable<T>.

适用于