コード例 #1
0
ファイル: Program.cs プロジェクト: KostaDinkov/SoftUni
        public static void Main()
        {
            Kitten[] kittens = new[]
            {
                new Kitten("Hello Kitty", 4),
                new Kitten("Catwoman", 6),
                new Kitten("Thunder cat", 11)
            };

            Tomcat[] tomcats = new[]
            {
                new Tomcat("Mr. Bigglesworth", 2),
                new Tomcat("Felix", 5),
                new Tomcat("Tom", 2)
            };

            Dog[] dogs = new Dog[]
            {
                new Dog("Brian Griffin", 2, Genders.Male),
                new Dog("Too stupid dog", 5, Genders.Male),
                new Dog("Eddie from Frasier", 7, Genders.Male)
            };

            Frog[] frogs = new[]
            {
                new Frog("Hypnotoad from Futurama", 13, Genders.Male),
                new Frog("Kermit", 50, Genders.Male),
                new Frog("Prince Charming", 30, Genders.Male),
            };

            Console.WriteLine("Average kitten age: {0}", kittens.Average(n => n.Age));
            Console.WriteLine("Average tomcat age: {0}", tomcats.Average(n => n.Age));
            Console.WriteLine("Average dog age: {0}", dogs.Average(n => n.Age));
            Console.WriteLine("Average frog age: {0}", frogs.Average(n => n.Age));
        }