简体   繁体   English

在CodeActivity中获取参数值(Windows Workflow Foundation)

[英]Get an argument's value in a CodeActivity (Windows Workflow Foundation)

Considering a Windows Workflow Foundation code activity such as this: 考虑Windows Workflow Foundation代码活动,例如:

public sealed class MyActivity : CodeActivity
{
    public InArgument<string> SomeValue { get; set; }

    protected override void Execute(CodeActivityContext context)
    {
    }
}

Is there any difference between 两者之间有什么区别吗?

var x = context.GetValue(SomeValue);

and

var x = SomeValue.Get(context);

They will return exactly the same value 它们将返回完全相同的值

string x = context.GetValue(SomeValue); string x = context.GetValue(SomeValue);

subsequently it can be written as string x = SomeValue.Get(context); 随后它可以写成字符串x = SomeValue.Get(context);

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM