Difficulty: Easy
Correct Answer: True
Explanation:
Introduction / Context:
This statement checks your knowledge of where properties may be declared in C#. Properties are type members and can appear in several kinds of types.
Given Data / Assumptions:
Concept / Approach:
Properties are members of types, not namespaces or methods. C# allows properties in classes, structs, and interfaces. Interfaces declare property signatures (no bodies); classes/structs provide implementations.
Step-by-Step Solution:
Verification / Alternative check:
Attempting to declare a property in a namespace or inside a method causes a compile-time error.
Why Other Options Are Wrong:
They inappropriately restrict where properties can be declared.
Common Pitfalls:
Confusing interface property signatures (no bodies) with class/struct implementations.
Final Answer:
True
Discussion & Comments