How to not return null when a Data member field is not set in the data contract?

You can mark each data member so it won't be serialized if it's null. The essential part is: EmitDefaultValue = false DataContract public class Person { DataMember(EmitDefaultValue = false) public string id { get; set; } DataMember(EmitDefaultValue = false) public string firstname { get; set; } DataMember(EmitDefaultValue = false) public string lastname { get; set; } DataMember(EmitDefaultValue = false) public string city { get; set; } }.

Cool....this is what i'm looking for. Thanks. – user330612 Apr 16 at 16:52 I still have one more problem though...the total no of possible fields of a customer is quiety large....like say 50...and so I was thinking if there is better way to solve this problem rather than having them as properties in the class...any idea?

– user330612 Apr 16 at 16:55.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions