CSharp examples for Custom Type:delegate
A delegate can have more specific parameter types than its method target. This is called contravariance.
As with type parameter variance, delegates are variant only for reference conversions.
using System;/*w w w. j av a 2s .com*/ delegate void StringAction (string s); class Test { static void Main() { StringAction sa = new StringAction (ActOnObject); sa ("hello"); } static void ActOnObject (object o) => Console.WriteLine (o); // hello }