Can I use a LINQ Query such as the following in a Workflow?
Yes, you can use LINQ with a Workflow in exactly the same way.
Step 1: Create a Workflow with an In Argument of type IEnumerable<string>
Here you can see that I’ve added the in argument
Step 2: Add a Variable for the query of type IEnumerable<string>
Before you can add a variable you need to include an activity which has variables. In this workflow I’ve added a sequence.
Step 3: Assign the query the LINQ expression you want to use
You can use a method chain or query syntax.
Step 4: Iterate over the collection
In the completed workflow I used a ForEach<string> activity to iterate the list of names and write them to the console.
This example uses C# in .NET 4.5 but the same technique can be used with Visual Basic.
When you run it you can see that both methods work the same.