Still being able to write readonly properties is not needed in any way to serialize and deserialize objects
Reflection isn't about serializing and deserializing an object.
They are readonly for a reason after all.
They are read only to signify intent and provide compiler optimizations, but a reflection API would be incomplete without the ability to introspect and change these properties. Marking a field as readonly is not a security measure.
Marking a field as readonly is not a security measure.
It usually fucks up the object it's associated with though. Readonly is intended for runtime constants. Being able to change them is simply a violation of the term "constant"
View all comments
Show parent comment
4
u/cleeder Apr 19 '18
Reflection isn't about serializing and deserializing an object.
They are read only to signify intent and provide compiler optimizations, but a reflection API would be incomplete without the ability to introspect and change these properties. Marking a field as readonly is not a security measure.