070-483 Free Dumps Study Materials
Question 1: An application serializes and deserializes XML from streams. The XML streams are in the
following format:
The application reads the XML streams by using a DataContractSerializer object that is declared by
the following code segment:
var ser = new DataContractSerializer(typeof(Name));
You need to ensure that the application preserves the element ordering as provided in the XML
stream.
How should you complete the relevant code? (To answer, drag the appropriate attributes to the
correct locations in the answer area-Each attribute may be used once, more than once, or not at all.
You may need to drag the split bar between panes or scroll to view content.)
Correct Answer:Explanation
Target 1: The DataContractAttribute.Namespace Property gets or sets the namespace for the data
contract for the type. Use this property to specify a particular namespace if your type must return
data that complies with a specific data contract.
Target2, target3: We put Order=10 on FirstName to ensure that LastName is ordered first.
Note:
The basic rules for data ordering include:
* If a data contract type is a part of an inheritance hierarchy, data members of its base types are
always first in the order.
* Next in order are the current type's data members that do not have the Order property of the
DataMemberAttribute attribute set, in alphabetical order.
* Next are any data members that have the Order property of the DataMemberAttribute attribute
set. These are ordered by the value of the Order property first and then alphabetically if there is
more than one member of a certain Order value. Order values may be skipped.
Reference: Data Member Order
https://msdn.microsoft.com/en-us/library/ms729813(v=vs.110).aspx
Reference: DataContractAttribute.Namespace Property
https://msdn.microsoft.com/en-
us/library/system.runtime.serialization.datacontractattribute.namespace(v=vs.110