Workflow 4 InArgument<List<int>>
In Workflow 3.x you can have a dependency property List<int> and in the designer you could click on the "..." and add values directly to the list<int>
In workflow 4, how is this achieved?开发者_如何学运维 Is the only way is to define a Variable type List<T>
and then using the AddToCollection<T>
activity to add values to the list. And then pass the variable as the InArgument of the custom activity?
There is no such thing as a collection literal in VB (or C#), but you can create an expression that creates a collection initialisation expression.
In VB:
New List(Of Integer) From {1, 2, 3, 4}
is equivalent to the C#:
new List<T> { 1, 2, 3, 4 }
and this can be used in the expression for an Assign
activity or in the default for a variable.
Another alternative is to create a custom activity derived from either CodeActivity
(if no result) or CodeActivity<T>
(if there is a result). This could be combined with a custom designer if needed.
精彩评论