I have a question about the [DataContract]
attribute.
I have written my code like below: here I am not using [DataContract]
attribute for my test class.
class test
{
[Datamember]
public string Strproperty
{
get;
set;
}
[Datamemer]
public string Strproperty2
{
get;
set;
}
}
class checktotal:Iservice
{
public string testmethod(test obj)
{
return obj.Strproperty+Strproperty2;
}
}
For that I am sending data from client I am getting the values correctly.
Here is it necessary to use [DataContract]
attribute for that test class?
If I removed [Datamember]
for test class property is getting error while sending from client. But I am not getting any errors even if I am not using the [DataContract]
attribute.
Please give me a brief explanation with example so that I can understand when to give that attribute and when do not give that attribute.
Thanks, Satya Pratap.