Using generic interface in a generic class

How force to use class that implement generic interface in class?
Is something like this possible?

public interface IGeneric<T>
{
    T Value {get;}
}

//public class MyList<IGeneric<T>> {}//not allowed

>Solution :

Something like this:

public class MyList<T> where T : IGeneric<T>
{
    
}

Or this:

public class MyList<T> : IGeneric<T>
{
    public T Value => throw new NotImplementedException();
}

Leave a Reply