PrepAway - Latest Free Exam Questions & Answers

Which approach should you choose?

You are an enterprise application developer. You are creating a component that stores employee details in a Microsoft SQL Server database. The component is implemented as a class. The class includes the public properties ID and Name. The class does not contain static methods. Both the ID field and the Name field are required in the Employee table of the database. Serialized instances of the class can be returned by XML Web services. You need to ensure that the class supports XML serialization. You also need to minimize the possibility of a developer creating a class instance by using partial data.
Which approach should you choose?

PrepAway - Latest Free Exam Questions & Answers

A.
Provide a single constructor that requires both Name and ID parameters.

B.
Provide a default constructor and a constructor that requires both Name and ID parameters.

C.
Provide a default constructor, a constructor that requires an ID parameter, and a constructor that requires a Name parameter.

D.
Provide a static constructor without any parameter and a constructor that requires both Name and ID parameters.


Leave a Reply