Sometimes I found myself in need to run one line of vb.net code. I am lucky if the code actually returns something - I can use Assign activity with the code you need to run on the right side of the equation. If there is nothing to return, I have to use Invoke Code activity, that is not very convenient for just one line of the code, because you need to import all the arguments before you can use them.
- File.ReadAllLines - a good example for use in an Assign activity.
- File.WriteAllLines - doesn’t return anything and I have to use Invoke Code activity. For example, if I use 3 variables in filename/path, I’d have to pass a total of 4 arguments inside the activity to run this. Which I think is a bit overkill to import lots of variables every time for just one line of code.
Basically, I’d use Invoke Code with no issues, if it’d be able to access all of the variables available in the scope from which the call was made.
So my question is, how do you do such one-liners?