nerdexam
Microsoft

98-361 · Question #103

You have a class with a property. You need to ensure that consumers of the class can write to the value of the property. Which keyword should you use?

The correct answer is D. set. The set { } implementation receives the implicit argument "value." This is the value to which the property is assigned. * Property. On a class, a property gets and sets values. A simplified syntax form, properties are implemented in the IL as methods (get, set).

Understanding Object-Oriented Programming

Question

You have a class with a property. You need to ensure that consumers of the class can write to the value of the property. Which keyword should you use?

Options

  • Avalue
  • Badd
  • Cget
  • Dset

How the community answered

(18 responses)
  • A
    6% (1)
  • B
    11% (2)
  • C
    6% (1)
  • D
    78% (14)

Explanation

The set { } implementation receives the implicit argument "value." This is the value to which the property is assigned. * Property. On a class, a property gets and sets values. A simplified syntax form, properties are implemented in the IL as methods (get, set).

Topics

#property accessors#set keyword#class properties#encapsulation

Community Discussion

No community discussion yet for this question.

Full 98-361 Practice