Create Class dynamically at runtime

后端 未结 4 1008
陌清茗
陌清茗 2020-12-30 15:51

I have a method like this: (this is a generic method, and DYNAMIC_CLASS_TYPE will be changed in situation to other situation)

Dim res = f.MyMeth         


        
4条回答
  •  有刺的猬
    2020-12-30 16:03

    There seems to be a bug. I think this line:

    Dim field As FieldBuilder = myType.DefineField("_" + o.Key, GetType(Integer), FieldAttributes.[Private])
    

    should look like this:

    Dim field As FieldBuilder = myType.DefineField("_" + o.Key, o.Value, FieldAttributes.[Private])
    

    Regards.

提交回复
热议问题