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

孤街浪徒 提交于 2019-12-01 20:46:13

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(...).

If you use Expressions to CodeDOM it could be

var cls = Define.Class("Refund", 
   TypeAttributes.Public | TypeAttributes.Sealed, true)
   .Inherits(CodeDom.TypeRef("DataObjectBase","Refund"))
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!