コード例 #1
0
        /**
         * ### 8. feladat ###
         * egyszeru egy felteteles query csokkeno sorrendben, csak az elso elemmel
         *
         * custom header kell, mert csak egy elemmel terunk vissza ilyenkor nem irja ki automatikusan
         */
        private void Task8()
        {
            Athletes query = (from athlete in athletes
                              where athlete.Team == "Norway"
                              orderby athlete.Height descending
                              select athlete).FirstOrDefault();

            using (var writer = new StreamWriter(Path.Combine(outPutFolder, task8Name)))
                using (var csv = new CsvWriter(writer, CultureInfo.InvariantCulture))
                {
                    csv.WriteHeader <Athletes>();
                    csv.NextRecord();
                    csv.WriteField(query.ToString(), false);
                    writer.Flush();
                }
            Console.WriteLine("{0} created", task8Name);
        }