What is the use of Is Required Property in Data Contracts?

 Posted by Majith on 5/26/2011 | Category: WCF Interview questions | Views: 7231 | Points: 40
Answer:

Data Contracts, is used to define Required or NonRequired data members. It can be done with a property named IsRequired on DataMember attribute.

[DataContract]
public class test
{
[DataMember(IsRequired=true)]
public string NameIsMust;

[DataMember(IsRequired=false)]
public string Phone;
}



Regards,
Majith.B


Source: msdn | Asked In: Many Interviews | Alert Moderator 

Comments or Responses

Login to post response