Difficulty: Easy
Correct Answer: Properties of a class are actually methods (get/set) that behave like data members.
Explanation:
Introduction / Context:
The question probes what a property truly is under the hood in C#.NET and clarifies common misconceptions about accessors and overloading.
Given Data / Assumptions:
Concept / Approach:
A property compiles to accessor methods (get and/or set). It can be read-only (get only), write-only (set only), or read-write (both). Overloading properties by parameter list is not applicable (that is what indexers are for), and you cannot have two properties with the same name differing only by type.
Step-by-Step Solution:
Verification / Alternative check:
Inspect IL: a property named P compiles to methods get_P and/or set_P.
Why Other Options Are Wrong:
They either overconstrain accessors or mischaracterize property behavior; C states the core truth.
Common Pitfalls:
Confusing properties with indexers (which do take parameters) or assuming accessor presence is mandatory.
Final Answer:
Properties of a class are actually methods (get/set) that behave like data members.
Discussion & Comments