Question 9


Exam Question

Drag and Drop

An applicaton serializes and deserializes XML from streams. The XML streams are in the following format:

var ser = new DataContractSerializer(typeof(Name)))
You need to ensure that the applicaton preserves the element ordering as provided in the XML stream.
How should you complete the relevant code?

  • [DataContract (Namespace="http://ww.contoco.com/2012/06")]
  • [DataMember(Order=10)]
  • [DataMember]
  • [DataMember (Name="http://ww.contoco.com/2012/06"), Order=10]
  • [DataContract]
  • [DataMember (Name="http://ww.contoco.com/2012/06")]
    {
      public string FirstName {get;set;}
        public string LastName {get;set;}
        }

        Answer:

        • [DataMember]
        • [DataMember (Name="http://ww.contoco.com/2012/06"), Order=10]
        • [DataMember (Name="http://ww.contoco.com/2012/06")]
        • [DataContract (Namespace="http://ww.contoco.com/2012/06")]
        {
        • [DataMember(Order=10)]
        public string FirstName {get;set;}
        • [DataContract]
        public string LastName {get;set;}
        }