将现有属性转换为 CustomAttributeBuilder 以插入到动态生成的类中
我试图找出采用以下类的最佳方法:
public class ModelX {
[TheAttribute(1, "two")]
[SomeOtherAttribute(Three.Four)]
public string Foo {get;set;}
并将这些复制到
public class DynamicallyCreatedModelX {
[TheAttribute(1, "two")]
[SomeOtherAttribute(Three.Four)]
public string Foo {get;set;}
我不是将数据从已知类传递到动态类的最佳方法。
I'm trying to figure out what would be the best way take a class such as:
public class ModelX {
[TheAttribute(1, "two")]
[SomeOtherAttribute(Three.Four)]
public string Foo {get;set;}
And copy these onto
public class DynamicallyCreatedModelX {
[TheAttribute(1, "two")]
[SomeOtherAttribute(Three.Four)]
public string Foo {get;set;}
I'm not what would be the optimal way to pass the data over from the known to the dynamic class.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
设置属性(或任何成员)的属性可以如下所示:
set attributes for properties (or any members) can be like this: