问题
This is kind of piggybacking off of this question: ASP.NET: Shadowing Issues
I've discovered that the issue isn't actually that the property isn't getting serialized, it is, but that BOTH the shadowed and shadowing properties are getting serialized, and since the shadowed property is being serialized second, its value is the one that is available via JSON to my Javascript. My serialization code looks like this.
How can I ensure that my shadowed property does not get serialized, while still making that property available for serialization when that actual object (the base type object) needs to be serialized? Or at the VERY least, switch the order the properties are serialized so the correct one overrides the incorrect one?
来源:https://stackoverflow.com/questions/5570658/prevent-shadowed-property-from-getting-serialized