示例#1
0
        delegate void MyDelegate<in T>(T a);  // in - Для аргумента.

        public static void CatUser(Animal animal)
        {
            Console.WriteLine(animal.GetType().Name);
        }
        static void Main(string[] args)
        {
			Animal a1 = new Animal();
			Animal a2 = new Dog();
			Console.WriteLine("Number of legs: {0}", a2.NumberOfLegs);
		}
示例#3
0
		static void ActOnAnimal(Animal a)
		{
			Console.WriteLine(a.NumberOfLegs);
		}