PdfPrep.com

What should you do?

You are designing a Windows Communication Foundation (WCF) service that uses the Product class.

You need to update the class to meet the storage requirement.

What should you do? (Each correct answer presents part of the solution. Choose all that apply.)
A . Mark the Product class with the DataContract attribute.
B . Mark the public members of the Product class with the DataContractFormat attribute.
C . Mark the Product class with the CollectionDataContract attribute.
D . Mark the public members of the Product class with the DataMember attribute.

Answer: A,D

Explanation:

So as of .NET 3.5 SP1, you don’t have to add data contract or data member attributes anymore – if you don’t then the data contract serializer will serialize all public properties on your class, just like the XML serializer would. HOWEVER: by not adding those attributes, you lose a lot of useful capabilities:

Exit mobile version