I have a method with this signature:
IEnumerable<string> GetCombinations(string s, int length)
And I am trying to use it with string.Join like this:
var combinations = GetCombinations(text, 2);
string result = string.Join(", ", combinations);
But I get the following compiler error:
cannot convert from 'System.Collections.Generic.IEnumerable<string>' to 'string[]'
Can’t string.Join take an IEnumerable<string>?
Call .ToArray on it?
EDIT
Also see Dan J’s answer: Since .Net 4 an overload of String.Join does accept an IEnumerable.