Esempio n. 1
0
        private void searchButton_Click(object sender, EventArgs e)
        {
            outputLabel.Text = null;

            string name = textBox1.Text;

            // This is to be completed in Part II. You will use
            // Lambda Expressions.
            //---------------------------

            // TODO - if object entered exists in list show it
            ClassInv player = classIn.Find(x => x.name == name);

            outputLabel.Text = player.name + "\n" + player.age + "\n" + player.team + "\n" + player.position;

            // TODO - else show not found message
        }
Esempio n. 2
0
        private void addButton_Click(object sender, EventArgs e)
        {
            // TODO - gather all information from screen
            string name     = nameInput.Text;
            int    age      = Convert.ToInt32(ageInput.Text);
            string team     = teamInput.Text;
            string position = positionInput.Text;

            // TODO - create object with gathered information
            ClassInv newClassInv = new ClassInv(name, age, team, position);

            // TODO - add object to global list
            classIn.Add(newClassInv);

            // TODO - display message to indicate addition made\
            outputLabel.Text = "A team member was added to the list \n";
        }