Sorting csv file
<p>I have e csv file wich I need to sort. The file looks like:</p>

<pre>
 ID Name Surname Age Salary
 1  John Asben   33  1000
 2  Adam Smith   22  1200
 3  Amanda J     22  2000
 4  George Villis 36  2300
</pre>

<p>My code read data from csv file sorts them and writes to another csv file, but when it reads and writes the data after sorting, it writes just data not the title. Is there any solution to read just data not the title and to write the sorted data With title(ID Name Surnae Age Salary) to another file.</p>

<p>The cole looks like</p>

<pre><code>private void buttonAlterSave_Click(object sender, EventArgs e)
        {
            var sorted =
    File.ReadLines(@"C:\Users\data.csv")
        .Select(line =&gt; new
        {
            SortKey = Int32.Parse(line.Split(',')[3]),
            Line = line
        })
        .OrderBy(x =&gt; x.SortKey)
        .Select(x =&gt; x.Line);
            File.WriteAllLines(@"C:\Users\sorteddata.csv", sorted);
        }
</code></pre>
