How to add a breakpoint to a public field that is serializable?
I have a fie开发者_C百科ld in a class that is serialzed:
[OptionalField(VersionAdded = 2)]
public bool IsUser;
From what I understand, both private fields and properties are not serialized correct?
I want to put a breakpoint to see how the property IsUser is modified throughout the page request, how can I do this while still maintaining that the field is serialized as it is now.
The first assumption is generally not correct. Is does depend upon the serializer though. For something marked with the Serializable Attribute, this should hold:
All the public and private fields in a type that are marked by the SerializableAttribute are serialized by default,
To add a breakpoint, create a setter/getter wrapping the value and add the break-point to the assignment in the setter.
Happy coding.
精彩评论