How to use the InvokeMethod activity to add a string to a generic list using Workflow Foundation 4

.net, .net-4.0, visual-studio-2010, workflow-foundation, workflow-foundation-4

Solution

Why not use the AddToCollection activity?

Problem

I have a Workflow Foundation 4 activity that has a InvokeMethod that is configured to call the `Add` method on an instance of type `IList(Of String)`, providing a parameter of type `String`. Running it gives me this error though: ``` 'IList`1' does not have a public instance method named 'Add' matching the parameter types, generic type arguments, and generic type constraints supplied to InvokeMethod 'InvokeMethod'. ``` I've tried all settings for the InvokeMethod activity I could think of, to no avail. So the question is: how do I make the InvokeMethod add the string parameter to the generic list?

Original source