在运行时创建属性 [英] Create properties at run time

查看:77
本文介绍了在运行时创建属性的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在运行时为类创建属性.
例如:我有一个"Customer"类.在运行时,我想向"Customer"类中添加"Name"和"Age"属性. 我怎样才能做到这一点?请帮助

I want to create properties for a class at run time.
For eg: I have a ''Customer'' class .At run time I would like to add properties ''Name'' and ''Age'' to the Customer class.
How can I do this? pls help

推荐答案

你好

我认为无法动态创建不动产,但这并不意味着您不能做任何事情!
请查看以下内容:如何在C#中创建动态属性?

也许这文章会有所帮助.
Hello

I think it''s not possible to create a real property dynamically but it doesn''t mean that you can''t doing anything!
Please look at this: How do I create dynamic properties in C#?

And maybe this article helps.


您看过 CodeDOM [

这篇关于在运行时创建属性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆