I’m trying to combine List<string> strings using string.Join(",", strings) but everything I’m reading says I should do:
string.Join(",", strings.ToArray())
Is there a certain reason I have to/should use .ToArray()?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
string.Joinonly started acceptingIEnumerable<string>(and indeed a generic overload) as of .NET 4. Presumably you’re looking at code (or instructions) written with .NET 3.5 or earlier in mind. Compare the overloads:string.Joinin .NET 3.5string.Joinin .NET 4