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()); }
static void Main(string[] args) { string[] token = Console.ReadLine() .Split(", ", StringSplitOptions.RemoveEmptyEntries) .ToArray(); Articles articles = new Articles(token[0], token[1], token[2]); int n = int.Parse(Console.ReadLine()); for (int i = 0; i < n; i++) { string[] inputComand = Console.ReadLine().Split(": ").ToArray(); string comand = inputComand[0]; string argument = inputComand[1]; switch (comand) { case "Edit": articles.Edit(argument); break; case "ChangeAuthor": articles.ChangeAutor(argument); break; case "Rename": articles.Rename(argument); break; } } Console.WriteLine(articles.ToString()); }