public static void Main() { string[] input = Console.ReadLine().Split(", ").ToArray(); int numberCommand = int.Parse(Console.ReadLine()); Articles list = new Articles(input[0], input[1], input[2]); for (int i = 0; i < numberCommand; i++) { string[] line = Console.ReadLine().Split(": ").ToArray(); string command = line[0]; if (command == "Edit") { string newContent = line[1]; list.Editing(newContent); } else if (command == "ChangeAuthor") { string newAuthors = line[1]; list.ChangeAuthor(newAuthors); } else if (command == "Rename") { string newName = line[1]; list.Rename(newName); } } list.ToString(); }
static void Main(string[] args) { var article = Console.ReadLine().Split(", "); var newArticles = new Articles(article); var numberOfArticles = int.Parse(Console.ReadLine()); for (int i = 0; i < numberOfArticles; i++) { var command = Console.ReadLine().Split(": ", StringSplitOptions.RemoveEmptyEntries); switch (command[0]) { case "Rename": newArticles.Rename(command[1]); break; case "Edit": newArticles.Edit(command[1]); break; case "ChangeAuthor": newArticles.ChangeAuthor(command[1]); break; } } Console.WriteLine(newArticles.ToString()); }