nerdexam
Microsoft

98-361 · Question #249

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 C. 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

  • AAdd
  • Bvalue
  • CSet
  • DGet

How the community answered

(31 responses)
  • A
    10% (3)
  • B
    6% (2)
  • C
    81% (25)
  • D
    3% (1)

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

#properties#setter#encapsulation#OOP keywords

Community Discussion

No community discussion yet for this question.

Full 98-361 Practice