What is data contract equivalence?

 Posted by Sgandikota on 7/14/2011 | Category: WCF Interview questions | Views: 7865 | Points: 40

Two data contracts are said to be equivalent, if they satisfy the following conditions.
- Both the datacontracts must have same namespace
- Both the datacontracts must have same name
- The data member on data contract must have an equivalent data member on the other.
- The members in the datacontract must appear in the same order in both datacontracts.


The following two data contracts are equal.

public class Person
public string Name;

public string Email_ID;

[DataContract(Name = "Person")]
public class Employee
[DataMember(Name = "Name")]
private string EmpName;

private string address;

[DataMember(Name = "Email_ID")]
private string EmpEmailId;

Asked In: Many Interviews | Alert Moderator 

Comments or Responses

Login to post response