I have a little problem that is a little frustrating. Is it possible to set a default value when deserializing xml in C # (.NET 3.5)? Basically, I'm trying to deserialize some xml that is not under my control, and one element looks like this:
<assignee-id type="integer">38628</assignee-id>
it might also look like this:
<assignee-id type="integer" nil="true"></assignee-id>
Now in my class, I have the following property, which should receive data:
[XmlElementAttribute("assignee-id")]
public int AssigneeId { get; set; }
This works fine for the first example xml element, but the second fails. I tried changing the type of the property to be int? but it doesnβt help. I will need to serialize it back to the same XML format at some point, but I'm trying to use the built-in serialization support without resorting to using my own.
- ?