How do I create a class that inherits from another and passes a type parameter in CodeDom?

前端 未结 2 1868
感情败类
感情败类 2021-01-20 03:42

Here\'s what I want the resulting class declaration to look like:

public sealed partial class Refund : DataObjectBase
 {
}

}<

2条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2021-01-20 04:26

    I think that the following string for the BaseType should do the trick (untested):

    "DataObjectBase`1[[Refund]]"
    

    It may be possible that you need to provide a fully-qualified name for Refund, at least including the assembly name:

    "DataObjectBase`1[[Refund, RefundAssembly]]"
    

    And you should then remove the line targetClass.TypeParameters.Add(...).

提交回复
热议问题