PrepAway - Latest Free Exam Questions & Answers

What should you do?

A Windows Communication Foundation (WCF) application uses a data contract that has several data members.
You need the application to throw a SerializationException if any of the data members are not present when a serialized instance of the data contract is deserialized.
What should you do?

PrepAway - Latest Free Exam Questions & Answers

A.
Add the KnownType attribute to the data contract.
Set a default value in each of the data member declarations.

B.
Add the KnownType attribute to the data contract.
Set the Order property of each data member to unique integer value.

C.
Set the EmitDefaultValue property of each data member to false.

D.
Set the lsRequired property of each data member to true.

Explanation:
DataMemberAttribute.IsRequired Property
Gets or sets a value that instructs the serialization engine whether the member must be present in the serialized data when it is being deserializing.

DataMemberAttribute.IsRequired Property
(http://msdn.microsoft.com/en-us/library/system.runtime.serialization.datamemberattribute.isrequired.aspx)

Data Contract Versioning
(http://msdn.microsoft.com/en-us/library/ms731138%28v=VS.100%29.aspx)

One Comment on “What should you do?


Leave a Reply