开发者

Windows Workflow 4 Set Properies?

开发者 https://www.devze.com 2023-03-22 12:36 出处:网络
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 f

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消