Windows Workflow 4 Set Properies?
I have an InvokeMethod activity in a Sequence for "MyObject", and run MethodName "MyMethod". The Method takes no parameters, but MyMethod expects a value to be there. If I was calling the object from C# code I would do
var myObject = new MyObject { MyParam = something };
Is there a way to do that in WF?
开发者_StackOverflow中文版Thanks.
It depends on how the instance of MyObject is instantiated.
The easiest way is to set the MyParam property when creating the instance. If you do this in the Variables tab for a given scope, you would set the Default as follows:
New MyObject With {.MyParam = something}
Note that you must use VB.NET syntax.
Alternately just create a custom class that descends from CodeActivity and write C# code. You won't even need the InvokeMethod activity then.
精彩评论