Covariance problem facing in C#
Asked By
0 points
N/A
Posted on - 01/26/2012

I have got class declared like this:
internal private abstract class BoxGroup<TS> : IBoxGroup where TS : SavedState
In that class I have this method:
protected virtual TS saveState() { return new SavedState(Width, Height); }
I thought that this will be correct but I see red line under return statement and Resharper says that new SavedState(Width, Height) cannot be converted to TS. I don't know why. I thought that TS can by any class that extends SavedState but also SavedState itself. What can I do to correct it?
