C#.NET — Applying an attribute to an assembly: choose the correct syntax.
-
A[ AssemblyDescription("DCube Component Library") ]
-
B[ assembly : AssemblyDescription("DCube Component Library") ]
-
C[ AssemblyInfo : AssemblyDescription("DCube Component Library") ]
-
D< Assembly: AssemblyDescription("DCube Component Library") >
-
E(Assembly: AssemblyDescription("DCube Component Library"))
Answer
Correct Answer: [ assembly : AssemblyDescription("DCube Component Library") ]
Explanation
Introduction / Context:Assembly-level attributes annotate the entire assembly (not a single type or member). They require a target specifier in attribute syntax.
Given Data / Assumptions:
- Target is the assembly.
- Attribute example: AssemblyDescription.
Concept / Approach:Assembly attributes use square brackets with a target prefix: [assembly: SomeAttribute(...)]. This is placed typically in AssemblyInfo files or any compilation unit.
Step-by-Step Solution:
Accept syntax with “assembly:” target in square brackets.Reject forms lacking the target specifier or using angle/round brackets.Verification / Alternative check:Place the line in a project’s AssemblyInfo.cs and build; it compiles and appears in assembly metadata.
Why Other Options Are Wrong:They either omit the target or use invalid delimiters or identifiers.
Common Pitfalls:Forgetting the target prefix (assembly:, module:, etc.).
Final Answer:[ assembly : AssemblyDescription("DCube Component Library") ]