Esempio n. 1
0
        static void Main(string[] args)
        {
            Cow a = new Cow {
                Name = "Leah"
            };

            //Adding Cow a to lol
            a.Moo += lol;
            Cow b = new Cow {
                Name = "Olga"
            };

            //Adding Cow b to lol
            b.Moo += lol;


            //Getting a random cow     a / b
            //Cow rndCow = new Cow();
            //Random rnd = new Random();
            //if (rnd.Next() % 2 == 0)
            //    rndCow = a;
            //else
            //    rndCow = b;

            //Same thing as above
            // ? = if       : = else

            Cow rndCowd = new Random().Next() % 2 == 0 ? a : b;

            rndCowd.BeTrippedOver();
            Console.ReadLine();
        }