Michal_5 0 Newbie Poster

Hi All.
I have a problem with col sorting of my csv file

 public static void SORT(string input, int col_num)
        {
            string[] lines = input.Split(new[] { Environment.NewLine }, StringSplitOptions.None);
            var data = lines.Skip(1);
            var sorted = data.Select(line => new
            {
                SortKey = Int32.Parse(line.Split(';')[16]),
                Line = line
            }
            ).OrderBy(x => x.SortKey).Select(x => x.Line).ToList();

            Console.WriteLine(output);
            File.WriteAllLines("D:\\sortedCsv.csv", lines.Take(1).Concat(sorted), Encoding.Default);

        }

What I receive is an error: input string in incorrect format and I dont know how to fix it.