我正在做一個非常簡單的東西,但不工作。我有,無法將類型'B <A>'隱式轉換爲'B <IA>'?
public class A : IA
{
}
public interface IA
{
}
public class B<T> where T : IA
{
}
現在我使用Autofac註冊此,
builder.Register<B<IA>>(b =>
{
return new B<A>();
});
但我收到此錯誤,
Cannot implicitly convert type 'B<A>' to 'B<IA>'?
Cannot convert lambda expression to delegate type 'System.Func<Autofac.IComponentContext,B<IA>>' because some of the return types in the block are not implicitly convertible to the delegate return type