范型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());
結果
本文配套源碼:http://www.bianceng.net/dotnet/201208/239.htm