// The Structure of the Container and the items
public interface IContainer <TItem> where TItem : IItem
{
}
public class AContainer : IContainer<ItemA>
{
}
public interface IItem
{
}
public class ItemA : IItem
{
}
// Client app
[Test]
public void Test ()
{
IContainer<IItem> container = new AContainer();
}
質問:テストでは、次のエラーが発生します。鋳造の解決策は何でしょうか?
タイプ「AContainer」を「IContainer」に暗黙的に変換することはできません。明示的な変換が存在します(キャストがありませんか?)