英语翻译如题,小弟在看WF4的时候,有如下这段代码:public class HelloWorkflow :Activity{public HelloWorkflow(){this.Implementation = () => new Sequence{Activities = {new WriteLine(){Text="Hellow workflow"}}};}}在HelloWorkflow的构
来源:学生作业帮助网 编辑:作业帮 时间:2024/09/02 07:57:36
英语翻译如题,小弟在看WF4的时候,有如下这段代码:public class HelloWorkflow :Activity{public HelloWorkflow(){this.Implementation = () => new Sequence{Activities = {new WriteLine(){Text="Hellow workflow"}}};}}在HelloWorkflow的构
英语翻译
如题,小弟在看WF4的时候,有如下这段代码:
public class HelloWorkflow :Activity
{
public HelloWorkflow()
{
this.Implementation = () => new Sequence
{
Activities = {
new WriteLine(){Text="Hellow workflow"}
}
};
}
}
在HelloWorkflow的构造方法中,有一段lambda表达式,我在这方面十分的薄弱,还望高人帮忙翻译一下这段lambda表达示的意图,也就是搞成普通的方法形式.
像int a=(b,c)=>a+b;但是他这种写法,我真是还原不回去.
分不多,在此先谢过了,
英语翻译如题,小弟在看WF4的时候,有如下这段代码:public class HelloWorkflow :Activity{public HelloWorkflow(){this.Implementation = () => new Sequence{Activities = {new WriteLine(){Text="Hellow workflow"}}};}}在HelloWorkflow的构
匿名委托啊,返回一个Sequence类型
类中定义一个委托
delegate Sequence se();
然后定义方法
Sequence ReturnSequence()
{
return new Sequence {
Activities = {
new WriteLine(){Text="Hellow workflow"}
}};
}
最后给那一段换成
se seq= ReturnSequence;
this.Implementation = seq();