PrepAway - Latest Free Exam Questions & Answers

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

PrepAway - Latest Free Exam Questions & Answers

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

6 Comments on “How should you complete the relevant code?

  1. v says:

    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.

    According to the rules LastName would appear first. Attributes in the answer should be reversed.
    https://msdn.microsoft.com/en-us/library/ms729813(v=vs.110)




    0



    0

Leave a Reply