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>?
What version of the .NET Framework are you using? The overload of String.Join that accepts an IEnumerable instead of an array was added in .NET 4.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With