コード例 #1
0
        private void BTFind_Click(object sender, EventArgs e)
        {
            string output = "";

            if (!support.IsStringEmpty(TBKey.Text))
            {
                string key             = TBKey.Text;
                object soughtForAnimal = collection.FindByKey(key);

                if (soughtForAnimal != null)
                {
                    if (key.Contains("Животное"))
                    {
                        KingdomAnimal animal = soughtForAnimal as KingdomAnimal;
                        output = animal.ToString();
                    }
                    if (key.Contains("Млекопитающее"))
                    {
                        ClassMammals mammal = soughtForAnimal as ClassMammals;
                        output = mammal.ToString();
                    }
                    if (key.Contains("Птица"))
                    {
                        ClassBirds bird = soughtForAnimal as ClassBirds;
                        output = bird.ToString();
                    }
                    if (key.Contains("Парнокопытное"))
                    {
                        OrderArtiodactyl artiodactyl = soughtForAnimal as OrderArtiodactyl;
                        output = artiodactyl.ToString();
                    }
                    TBOutput.Text += output;
                }
            }
            else
            {
                support.ShowMistake();
            }
        }
コード例 #2
0
 public void PrintThisType(ClassMammals individual)
 {
     PrintElThisType.Output(individual);
 }
コード例 #3
0
 public void Output(ClassMammals animal)
 {
     TBOutput.Text += animal.ToString();
 }