Shouldn't System.Collections already be referenced by any member of System.Collections.Generic, as it is a child?
No. There's no inheritance between namespaces. A using
directive only imports types from that namespace - it doesn't import types from namespaces starting with the given namespace, or namespaces included within the given namespace's name.
For example, after:
using System.Collections;
... that doesn't let you use List<T>
as a simple name for System.Collections.Generic.List<T>
, nor does it let you use Guid
as a simple name for System.Guid
.
The only exception to this is that if you're writing code within a namespace declaration of X.Y.Z
, that implicitly imports namespaces X.Y
and X
(as well as X.Y.Z
, of course). (In that example, X.Y
is the enclosing namespace if X.Y.Z
, but it's not an inheritance relationship.)