looking at this code
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
}
}
Is this code is working due to Contravariance ? ( MoreDeriverdRef <== LessDerivedRef )
or because
(unrelated to contravariance) - In c# I can execute a method like ActOnObject (object o)
with ActOnObject ("lalala")