Difficulty: Easy
Correct Answer: 1, 4, 5
Explanation:
Introduction / Context:
Interfaces in C#.NET define contracts that types agree to fulfill. This question checks core facts: what members an interface may declare, who can implement it, and how adding implementations affects existing code.
Given Data / Assumptions:
Concept / Approach:
Interfaces can declare members such as methods, properties, events, and indexers. Both classes and structs can implement interfaces. Adding new implementations (new classes/structs that implement the same interface) does not break existing consumers because existing binaries compile against the unchanged interface contract. In contrast, changing the interface (e.g., adding new required members) can break implementers.
Step-by-Step Solution:
Verification / Alternative check:
Define an interface with properties/methods/events; implement it in a class and a struct; add another class that implements it later. Existing code continues to work.
Why Other Options Are Wrong:
Common Pitfalls:
Confusing VB keywords with C#. Also, assuming you can change interface members freely without breaking existing implementers.
Final Answer:
1, 4, 5
Discussion & Comments