Question:Which of the following code samples will create a comma separated list from IList<string> or IEnumerable<string>? 

A ublic static T[] ToArray(IEnumerable<T> source) { return new List<T>(source).ToArray(); } IEnumerable<string> strings = ...; string[] array = Helpers.ToArray(strings); string joined = string.Join(",", strings.ToArray()); string joined = string.Join(",", new List<string>(strings).ToArray()); 

B List<string> ls = new List<string>(); ls.Add("one"); ls.Add("two"); string type = string.Join(",", ls.ToArray()); 

C string commaSeparatedList = input.Aggregate((a, x) => a + ", " + x) 

D public static string Join(this IEnumerable<string> source, string separator) { return string.Join(separator, source); } 

+ Answer
+ Report
Total Preview: 757

Copyright © 2024. Powered by Intellect Software Ltd