Converting array/list of file paths to IResource to use in Attachments property

I have a string array argument (e.g. arr_FilePath) containing a list of file paths that I need to add as attachments to the Send SMTP mail activity. Previously it was very straightforward as it accepted string array and no conversion is required, but now that it has changed to require IResource, how do I convert this array into the required type?

@metallion,

You can pass the array like this:

Declare a variable resources of datatype List(Of IResource) and default value as New List(Of IResource) From {}

Use Assign activity to get file paths into the resources variable to pass to your activity.

resources  = arr_FilePath.Select(Function(path) LocalResource.FromPath(path)).ToList()

Hi @metallion

You can use LocalResource to convert each file path into an IResource object.

Use this LINQ expression to convert arr_FilePath to IResource[]:

arr_Attachments = arr_FilePath.Select(Function(file) New LocalResource(file)).ToArray()