public abstract class EntityBase { ... }
public interface IFoobar
{
void Foo(int x)
where T : EntityBase, new();
}
public interface IFoobar<
Just try
void IFoobar.Foo(int x) { Foo(x); }
Of course, that still doesn't guarantee that U
is the same as T
. You can't enforce that at compile-time, because when you're implementing an interface, you must follow its rules -- and IFoobar
doesn't put such a restriction on Foo
, and if you do, you would no longer be implementing the interface (by definition, since you are being stricter, and yet you're claiming that you're not).
You can try checking it at run time instead, although that's somewhat "cheating" (since you're not really conforming to the interface then either).