You are here

C# CheatSheet

Creating a comma separated string from IList<string> or IEnumerable<string> IList<string> strings = new List<string>{"1","2","testing"}; string joined = string.Join(",", strings);   Creating a comma separated string from IList<int> or IEnumerable<int> List<int> list =List<int>{1,2,3}; string joined = string.Join(",", list.Select(n => n.ToString()).ToArray())   Converting a comma separated string ┬áto IList<int> or IEnumerable<int> string commaSeparatedString = "1,2,3"; List<int> list = Array.ConvertAll(commaSeparatedString .Split(','), int.Parse).ToList(); or string commaSeparatedString

Top