Suggested Answer:
Note: * The System.Runtime.Serialization namespace contains classes that can be used for serializing and deserializing objects. Serialization is the process of converting an object or a graph of objects into a linear sequence of bytes for either storage or transmission to another location. Deserialization is the process of taking in stored information and recreating objects from it. * EmitDefaultValue DataMemberAttribute.EmitDefaultValue Property Gets or sets a value that specifies whether to serialize the default value for a field or property being serialized. true if the default value for a member should be generated in the serialization stream; otherwise, false.
Yes (wether lastname will be filled or not, firstname always becomes the first element),
No - see output
No - if you don't fill it, it won't appear in the xml using the default value.
Output with first- and lastname:
<Individual xmlns="http://schemas.datacontract.org/2004/07/Console70483exam" xmlns:i="http://www.w3.org/2001/XMLSchema-instance"><FirstName>John</FirstName><LastName>Doe</LastName></Individual>
Output without firstname and lastname:
<Individual xmlns="http://schemas.datacontract.org/2004/07/Console70483exam" xmlns:i="http://www.w3.org/2001/XMLSchema-instance"><FirstName i:nil="true"/></Individual>
Oops. it's very important to know that the order in this case wont be changed and is the answer correct but it will change order alphabettically if the names where different for example i place a Z before firstname:
<Individual xmlns="http://schemas.datacontract.org/2004/07/Console70483exam" xmlns:i="http://www.w3.org/2001/XMLSchema-instance"><LastName>Doe</LastName><ZFirstName>John</ZFirstName></Individual>
If no Order is specified, it will be alphabetically: Firstname < LastName
EmitDefaultValue is set to False, therefore there when there is no default it will not be serialized
So YES,NO,NO?
No,No,No
Why first is NO? Ordering: https://docs.microsoft.com/cs-cz/dotnet/framework/wcf/feature-details/data-member-order?redirectedfrom=MSDN
upvoted 1 times
...
Log in to ExamTopics
Sign in:
Community vote distribution
A (35%)
C (25%)
B (20%)
Other
Most Voted
A voting comment increases the vote count for the chosen answer by one.
Upvoting a comment with a selected answer will also increase the vote count towards that answer by one.
So if you see a comment that you already agree with, you can upvote it instead of posting a new comment.
patoyanez
Highly Voted 5 years, 10 months agozzMichielzz
Most Recent 4 years, 2 months agozzMichielzz
4 years, 2 months agoHgstExam
4 years, 3 months agoslobex
4 years, 6 months agomajco333
5 years agomajco333
4 years, 12 months agomajco333
5 years ago