已定义以下内容:
public interface IFoo { }
public interface IBar<IFoo> { }
public class Foo : IFoo { }
public class Bar : IBar<Foo> { }
此行引发错误:
IBar<IFoo> test = (IBar<IFoo>) new Bar();
"Unable to cast object of type 'Bar' to type 'IBar'1[IFoo]'
那是为什么?我该如何解决这个问题?