Why collections classes in C# (like ArrayList) inherit from multiple interfaces if one of these interfaces inherits from the remaining?

前端 未结 6 1048
南笙
南笙 2020-12-08 07:28

When I press f12 on the ArrayList keyword to go to metadata generated from vs2008, I found that the generated class declaration as follows

public class Array         


        
6条回答
  •  离开以前
    2020-12-08 07:47

    From MSDN....

    If a class implements two interfaces that contain a member with the same signature, then implementing that member on the class will cause both interfaces to use that member as their implementation.

    Explicit implementation is also used to resolve cases where two interfaces each declare different members of the same name such as a property and a method:

提交回复
热议问题