예제 #1
0
        public UsersList Filtering(char target)
        {
            UsersList result = new UsersList();

            foreach (User user in this.Users)
            {
                if (user.Name.Contains(target, StringComparison.OrdinalIgnoreCase))
                {
                    result.Add(user);
                }
            }
            return(result);
        }
예제 #2
0
        public static void Main(string[] args)
        {
            User pino    = new User("Pino", 22);
            User bianca  = new User("Bianca", 17);
            User camilla = new User("Camilla", 15);
            User irina   = new User("Irina", 16);

            pino.Show();
            bianca.Show();

            UsersList underaged = new UsersList();

            underaged.Add(bianca);
            underaged.Add(camilla);
            underaged.Add(irina);
            underaged.List();

            UsersList filtered = underaged.Filtering('c');

            filtered.WriteToFile();
        }