parâmetro @Type 'T' tem o mesmo nome que o parâmetro type do tipo externo '…'
public abstract class EntityBase { ... }
public interface IFoobar
{
void Foo<T>(int x)
where T : EntityBase, new();
}
public interface IFoobar<T>
where T : EntityBase, new()
{
void Foo(int x);
}
public class Foobar<T> : IFoobar, IFoobar<T>
where T : EntityBase, new()
{
public void Foo(int x) { ... }
void IFoobar.Foo<T>(int x) { Foo(x); }
}
Recebo um aviso do compilador:Type parameter 'T' has the same name as the type parameter from outer type '...'
Eu tentei fazer:void IFoobar.Foo<U>(int x) { Foo(x); }
, no entanto, não posso garantir que U e T sejam iguais. Da maneira como a classe Foobar é implementada, é muito importante que sejam iguai
Eu também tentei fazer:void IFoobar.Foo<U>(int x) where U : T { Foo(x); }
, no entanto, isso não garante que U e T sejam iguais e não me permite redefinir a restrição, pois ela foi definida na interfac