Covariance,Contravariance,compatibility

private void button2_Click(object sender, EventArgs e)
{
// compatibility.
string str = "test";
object obj = str;

IEnumerable<string> strings = new List<string>();
// Covariance. parent class can take derived class objects --
// reverse of object,string is not acceptable
IEnumerable<object> objects = strings;


Action<object> actionObj = ObjectWork;
// Contravariance example .. notice reverse compatibility
Action<string> actString = actionObj;
}
static void ObjectWork(object o) { }