I have a list of string elements, each of which can contain a comma separated list of values. From that, I want to generate a list of all the distinct values in the entire set.

Take the following set of strings for example:

<!-- language-all: lang-vb -->
Dim strings = New List(Of String) From {"A", "B,C,D", "D,E"}

I'd like to turn this into:

{"A", "B", "C", "D", "E"}

Using linq, I could take each element and convert it into a string array. The following query will just split each string into an array, but it will stay stuffed in it's own array element.

Dim fieldsLinq = (From s In strings
                  Select s.Split(",")) _
                 .Distinct()

I want to concatenate the all of the values into a single array of strings.

I could start by joining all the elements with a comma and THEN splitting the single string, but this feels like the wrong approach.

Dim fieldsJoin = String.Join(",", strings) _
                       .Split(",") _
                       .Distinct()

Are there any better solutions?

I don't know VB that well but you could just use SelectMany to flatten the arrays. in C#

strings.SelectMany(o=>o.Split(","));