I hope this is the right forum for my question.

I am trying to write a generic class parameterized by an interface, and to down-cast an instance, but I always get an error. More exactly, I have the following:

Code:
interface IWhatever {... }

class IWhateverImpl : IWhatever { ... }

class CGeneric<T> where T:IWhatever { ... }

class Program {

    CGeneric<IWhatever> mGeneric;

    Program()
    {
         mGeneric = new CGeneric<IWhateverImpl>();
    }
...
}
The typecast in line:
Code:
 mGeneric = new CGeneric<IWhateverImpl>();
throws an exception.

Somehow I did not manage to google up this problem. Has anyone read anything about it, or has any idea about a solution / workaround to such a problem?