I\'ve just saw an unfamiliar syntax while looking for GroupBy
return type:
public interface IGrouping : IEnumerable<
It denotes a covariant parameter. See also the description on MSDN. Essentially it says, that IGrouping
can be regarded as IGrouping
, hence you can
IGrouping gr = MakeGrouping(...);
IGrouping grBase = gr;
if Aderived
is an interface or a type derived from Abase
. This is a feature that comes in handy when you want to call a method that requires a parameter of type IGrouping
, but you only got an object of type IGrouping
. In this case, both types can be considered equivalent due to the covariance of their type parameters.