代码之家  ›  专栏  ›  技术社区  ›  mark

发出从另一个类型派生的类型和带有反射的接口。发出

  •  0
  • mark  · 技术社区  · 15 年前

    class A: I
    {
      // implementation of I
    }
    

    还有一个接口J,它扩展了I:

    interface J : I
    {
      // J methods and properties.
    }
    

    我想发出一个动态B类,它看起来是这样的:

    class B : A, J
    {
      // All the constructors of A
      // All the methods of J, which are not implemented by A. Their implementation would just throw NotImplementedException()
    }
    

    我有足够的反省知识,发自内心去做,但是,唉,我真的不想。有人知道图书馆,哪一个能做到?

    谢谢。

    附笔。

    2 回复  |  直到 15 年前
        1
  •  0
  •   Andrey    15 年前

    当通过DefineType创建类型定义时,将使用基类和实现的接口进行重写: http://msdn.microsoft.com/en-us/library/f53tx4x8.aspx

        2
  •  0
  •   Krzysztof Kozmic    15 年前

    城堡动力 can be used to do it .