When to use DataContract and DataMember attributes?

I am very confused about the DataContract attribute in WCF. As per my knowledge it is used for serializating user defined type like classes. I wrote one class which is exposed at client side like this. [DataContract] public class Contact { [DataMember] public int Roll { get; set; } [DataMember] public string Name { get; … Read more

Namespace for [DataContract]

I can’t find the namespace to use for [DataContract] and [DataMember] elements. According to what I’ve found, it seems that adding the following should be enough, but in my case it is not. using System; using System.Runtime.Serialization; Here is a snippet of my code: using System; using System.Runtime.Serialization; namespace MyNamespace { [DataContract] public class Tuple<T1, … Read more