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


when press f12 on arraylist keyword go metadata generated vs2008, found generated class declaration follows

public class arraylist : ilist, icollection, ienumerable, icloneable 

i know ilist inherits icollection , ienumerable, why arraylist redundantly inherit these interfaces?

ok, i've done research. if create following hierarchy:

  public interface 1     {         void doit();     }      public interface 2 : 1     {         void doitmore();     }      public class magic : 2     {          public void doitmore()         {             throw new notimplementedexception();         }          public void doit()         {             throw new notimplementedexception();         }     } 

and compile it, reference dll in different solution, type magic , press f12, following:

 public class magic : two, 1     {         public magic();          public void doit();         public void doitmore();     } 

you see interface hierarchy flattened, or compiler adding interfaces in? if use reflector same results too.

update: if open dll in ildasm, see saying:

implements ...two

implements ...one.


Comments

Popular posts from this blog

html5 - What is breaking my page when printing? -

html - Unable to style the color of bullets in a list -

c# - must be a non-abstract type with a public parameterless constructor in redis -