WF4.0 基础篇 (二十三) 范型Activity
本文例子下载
https://files.cnblogs.com/foundation/GenericActivitySample.rar
范型Activity
Activity
public sealed class GenericActivity<T> : CodeActivity { public InArgument<ICollection<T>> myCollection { get; set; }
protected override void Execute(CodeActivityContext context) { ICollection<T> list = this.myCollection.Get<ICollection<T>>(context);
foreach (T obj in list) { Console.WriteLine(obj.ToString()); } } } |
使用
流程 | |
宿主 |
WorkflowInvoker.Invoke(new Workflow1()); |
结果 |