.netarraysinterfaceexplicit-interfaceexplicit-implementation

why does the Array class implement the Ilist Interface Explicitly not Implicitly?


My target language is C# with .net framework . I want to know what is the point or the reason behind this topic ?

any advice and suggestions would be highly Appreciated .

EDIT

why i asked this question ? because right now , some useful members of The Array class like index of is buring behind a cast !!! I am wondering would it be better if microsoft split the ilist interface?


Solution

  • It's worth noting to start with that you don't have to implement an entire interface implicitly or explicitly - it's a member-by-member decision... and I there are different reasons for different members. I'm only guessing (very few people can give a definitive answer here) but:

    In other words, if you already have the compile-time information that this is an array, you already either know the answer or definitely can't use these operations - or have a better way of doing it.

    The ones which could be reasonable:

    GetEnumerator (from IEnumerable) is already exposed via implicit interface implementation.