这是否意味着变量属性举行与我在对象中得到了相同的对象,或者一个新的TestObject参考有人认为,持有相同的价值观?
does this mean that the variable property hold a reference to the the same object that i got in object a , or a new testObject was made that holds the same values?
如果这意味着创建一个新的对象,然后我怎么可以得到参考该物业/支持字段使用反射?
if this means creating a new object, then how can i get the reference to that property/backing field using reflection?
推荐答案属性现在持有的 referece 应用于无论是在 A 的 DB 属性。
property now holds a referece to whatever is in a's DB property.
我不知道但是当你调用会发生什么的GetValue()对具有值类型的属性,我想你会得到原始值的装箱副本的引用,如装箱和拆箱(C#编程指南):
I'm not sure though what happens when you call GetValue() on a property that has a value type, I suppose you get a reference to a boxed copy of the original value, as explained in Boxing and Unboxing (C# Programming Guide):
拳击值类型[为对象在的GetValue()的情况下]分配的堆和值拷贝到新对象的对象实例。
Boxing a value type [to object in GetValue()'s case] allocates an object instance on the heap and copies the value into the new object.
更多推荐
获取使用反射属性参考
发布评论