Dave is correct; if you add in the variable types, you can see the problem more easily:
Dim entriesTasksQuery As IEnumerable(Of Task(Of IEnumerable(Of String))) = ...
It's obvious that you can't pass the
entriesTasksQuery
variable to a function that expects an array of
IEnumerable(Of String)
values.
The simplest option is to skip your custom function and call
SelectMany
directly:
Dim totalEntries as IEnumerable(Of String) = entriesTasksQuery.SelectMany(Function(x) x.Result)
NB: You'll also need a
ToArray
to get the
Task.WaitAll
call to work:
Task.WaitAll(entriesTasksQuery.ToArray())
Without that, you'll get a BC30512 compiler error
(Option Strict On disallows implicit conversions from 'IEnumerable(Of Task(Of IEnumerable(Of String)))' to 'Task'), or an
InvalidCastException
at runtime if you have
Option Strict Off
(definitely NOT recommended).