Change your GenericMethod
and add generic constraint class
:
public void GenericMethod(IEnumerable p) where T : class, ISomeInterface
{
IEnumerable e = p;
// or
TestMethod(p);
}
Covariance does not support structs, so we need to tell that we want to use classes only.