© 1999-2048 dssz.net 粤ICP备11031372号
[其它] C#反射技术的简单操作(读取和设置类的属性)
说明:要想对一个类型实例的属性或字段进行动态赋值或取值,首先得得到这个实例或类型的Type,微软已经为我们提供了足够多的方法。 首先建立一个测试的类 代码如下: public class MyClass { public int one { set; get; } public int two { set; get; } public int five { set; get; } public int three { set; get; } public int four { set; get; }<weixin_38747025> 上传 | 大小:40kb