using System;
using System.Collections.Generic;
namespace Covariance
{
class Fruit { }
class Orange : Fruit { }
class Apple : Fruit { }
class Program
{
static void Main(string[] args)
{
//this works fine
Fruit obj = new Apple();
//I am allowed to add orange to bunch of apples...
//so below code will not work....
List appleObjects = new List();
appleObjects.Add(new Orange());
//Make it Ienumerable...This will work..
IEnumerable appleObjects1 = new List();
//appleObjects1.Add(new Orange());
Console.ReadLine();
}
}
}