Example #1
0
        public static double CalculateAverageLINQ(Animals[] animalArray)
        {
            var result = (from animal in animalArray
                         select animal.Age).Average();

               return result;
        }
Example #2
0
        internal static void Main()
        {
            Animals[] animals =
            {
                new Cat(5,    "Myay",   true),
                new Cat(3,    "Myay",   true),
                new Cat(17,   "Myay",   true),
                new Dog(4,    "Bobcho", true),
                new Kitten(3, "nenka",  true),
                new Frog(3,   "penka",  false),
                new Tomcat(6, "Ivan",   false)
            };

            Animals.AverageAge(animals);
        }
Example #3
0
 static void Main()
 {
     Animals cat = new Animals();
 }