Ejemplo n.º 1
0
        private static bool Remove(string[] fields)
        {
            if (fields[0] != "remove")
            {
                return(false);
            }

            if (fields.Length < 2)
            {
                return(false);
            }

            string name = fields[1] == null ? null : fields[1];

            bool   success = shoppingList.Remove(name);
            string status  = success ? "removed from" : "not found in";

            Console.Out.WriteLine($"Item '{name}' {status} shopping list.");
            Console.Write(shoppingList.ToString());
            return(true);
        }