Difficulty: Easy
Correct Answer: using System.Windows.Forms; ListBox lb = new ListBox();
Explanation:
Introduction / Context:
This question verifies your understanding of using directives, type aliases, and fully qualified names for instantiating Windows Forms controls.
Given Data / Assumptions:
Concept / Approach:
There are three valid approaches: (1) import the namespace and use the type name; (2) fully qualify the type; (3) alias the specific type and instantiate via the alias. Aliasing a namespace to create an instance directly is incorrect.
Step-by-Step Solution:
Verification / Alternative check:
Compile each option in a minimal project; A, C, and E succeed; B and D fail.
Why Other Options Are Wrong:
Namespaces are containers, not constructible types; also 'using' cannot be used directly in a variable declaration like D.
Common Pitfalls:
Aliasing namespaces instead of types and assuming they can be constructed.
Final Answer:
using System.Windows.Forms; ListBox lb = new ListBox(); (Also valid in context: fully qualified type or type alias patterns.)
Discussion & Comments