Difficulty: Easy
Correct Answer: 3, 4
Explanation:
Introduction / Context:
Attributes in C#.NET are metadata attached to code elements (assemblies, types, members, parameters, etc.). Understanding when and how they can be inspected helps developers choose the right mechanism (reflection, analyzers, or tooling) for validation, diagnostics, and behavior changes.
Given Data / Assumptions:
Concept / Approach:
Attributes are stored in metadata and can be retrieved via reflection at run-time. Many IDEs and tools (design-time) read attributes to alter experience (e.g., designers, code generators). While compilers may react to certain attributes, general attribute inspection is typically done at run-time or by design-time tools.
Step-by-Step Solution:
Verification / Alternative check:
Write a short program that calls GetCustomAttributes on a type or member at run-time; observe returned attribute instances. In IDEs, attributes like Browsable or DisplayName change designer behavior at design-time.
Why Other Options Are Wrong:
Common Pitfalls:
Confusing compiler reaction to specific attributes with general-purpose attribute inspection available to user code.
Final Answer:
3, 4
Discussion & Comments