Say I have the following three classes/interfaces:
public interface IImportViewModel
{
}
public class TestImportViewModel : IImportViewModel
{
}
public class ValidationResult<TViewModel> where TViewModel : IImportViewModel
{
}
As TestImportViewModel implements IImportViewModel, why will the following not compile?
ValidationResult<IImportViewModel> r = new ValidationResult<TestImportViewModel>();
I understand what the error message "Cannot implicitly convert type 'ValidationResult' to 'ValidationResult'" means. I just don't understand why this is the case. Would this not be covariance?