Пример #1
0
        static void Main(string[] args)
        {
            int n = int.Parse(Console.ReadLine());

            Article[] article = new Article[n];

            for (int i = 0; i < n; i++)
            {
                string[] array = Console.ReadLine().Split(',', StringSplitOptions.RemoveEmptyEntries).ToArray();
                article[i] = new Article(array[0], array[1], array[2]);
            }

            string order = Console.ReadLine();

            switch (order)
            {
            case "title":
                article = article.OrderBy(x => x.Title).ToArray();
                foreach (var item in article)
                {
                    Console.WriteLine(item.ToString());
                }
                break;

            case "content":
                article = article.OrderBy(x => x.Content).ToArray();
                foreach (var item in article)
                {
                    Console.WriteLine(item.ToString());
                }
                break;

            case "author":
                article = article.OrderBy(x => x.Author).ToArray();
                foreach (var item in article)
                {
                    Console.WriteLine(item.ToString());
                }
                break;
            }
        }