Reputation: 4733
I have service which is doing a lot of things and then returns xml. my task was to add DateDeleted
property to it but that field must not be in xml.
[DataMember(IsRequired = true, EmitDefaultValue = true, Order = 15)]
[Column(TypeName = "datetime")]
public DateTime? DateDeleted { get; set; }
I add [XmlIgnore]
attribute to it but
<Organization>
<ID>4</ID>
<ParentID>0</ParentID>
<Name>name</Name>
...
<DateDeleted i:nil="true"/>
</Organization>
It anyway apperas here. XmlIgnore did job that in xml it dont gets value. How can I remove that tag from returned xml?
Upvotes: 1
Views: 71
Reputation: 1757
Remove DataMember
and you don't need [XmlIgnore]
too.
Upvotes: 1
Reputation: 874
You can disable serialization using the below:
[XmlIgnore]
public DateTime? DateDeleted { get; set; }
Upvotes: 0