简体   繁体   中英

set value of a property of an anonymous type using reflection / TypeDescriptor is it possible?

我尝试使用TypeDescriptor并且值没有改变,并且通过反射我得到一个错误,即该属性没有setter

C# anonymous types are immutable, and their properties cannot be changed.

If you really want to, you could set the backing field using reflection, but it would be a bad idea.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM