I have the following classes defined to do validation:
public class DefValidator : IValidate<IDef>
{
}
public interface IDef : IAttribute
{
}
Then, I have a list of validators defined as so:
IList<IValidate<IAttribute>> ValidationObjects;
When I try the following, it doesn't compile saying it can't convert types.
DefValidator defv = new DefValidator();
ValidationObjects.Add(defv);
When I try the following, it compiles but generates an exception saying "unable to cast object".
ValidationObjects.Add((IValidate<IAttribute>)defv);
Any ideas?