/* * To make an generic type-parameter in an interface * contravariance, we have to mark the type-parameter * in the interface (defintion/file) with the 'in' * keyword. * */ public void GetContraVarianceObject <TCon>(IStandardGen <TCon> standardGen) { Console.WriteLine("Contravariance"); }
/* * To make an generic type-parameter in an interface * covariance, we have to mark the type-parameter in * the interface (defintion/file) with the 'out' * keyword. * */ public void GetCovarianceObject <TCov>(IStandardGen <TCov> cov) { Console.WriteLine("Covariance"); }