Did they ever explain why System.Array doesn't follow inheritance rules?
-
It's a Friday and I'm tired of casting obvious parameters because of this.
System.Array
inherits fromSystem.Collections.ICollection
.
System.Collections.ICollection
defines anint Count
property.
System.Array
only hasLength
and notCount
.Why?
Is it like that funny business where I have to define but cover up
GetEnumerator()
to work right in some contexts (I forget why, this was years ago I read this)?System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() { foreach(mytype x in this.InternalList){yield return x;} } public System.Collections.Generic.IEnumerator<mytype> GetEnumerator() { foreach(mytype x in this.InternalList){yield return x;} }
-
@Zenith Why I don't quite understand is why explicit interface implementations become invisible without casting to the interface; which is what's happening here.
But perhaps the thing with the enumerators where the name and arguments are the same is a clue? I've got to leave so I can't think too much about this right now.
-
Array
is a framework construct propped up by a bunch of externs (native code) and as such is only larping asICollection
.