How should you complete the relevant code?

DRAG DROP
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.)

DRAG DROP
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.)

Answer:

Explanation:
DataContractAttribute – Specifies that the type defines or implements a data contract and is
serializable by a serializer, such as the DataContractSerializer. To make their type serializable, type
authors must define a data contract for their type.
http://msdn.microsoft.com/en-us/library/system.runtime.serialization.datacontractattribute.aspx
DataMemberAttribute – When applied to the member of a type, specifies that the member is part of
a data contract and is serializable by the DataContractSerializer.
http://msdn.microsoft.com/en-us/library/ms574795.aspx



Leave a Reply 6

Your email address will not be published. Required fields are marked *


Ravi

Ravi

1,2,3

Mohsin

Mohsin

No, it should be 1,3,2

Sjoerd

Sjoerd

No, it’s 1,2,3
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.

Lord Vader

Lord Vader

123 see sjoerd

YouCrackedMeUp

YouCrackedMeUp

I think the correct answer is 1 – 2 – 3 & all will be happy. 🙂