I always thought about this but never understood why.
Simple example:
public IEnumerator<Effect> GetEnumerator ( )
{
return this.Effects.GetEnumerator ( );
}
System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator ( )
{
return this.GetEnumerator ( );
}
Why do you have to specify:
System.Collections.IEnumerator
but not just:
Collections.IEnumerator
I am not saying this is better but to me it seems like it’s a step by step approach to solve collisions.
Because sometimes there are quite deeply nested types, so having to type the full name because of a collision feels bad, instead of just prefixing the type with the immediate namespace that contains it so the compiler can try to find it in the currently imported/used namespaces.
Also when I first started C#, I always find myself doing this, thinking this is how it would work. It would be cool to see how other people would have behaved coming fresh to C#, having never used namespace concepts before.
Because there is no such thing as
using System.*;This would work:
But you should not add anything to
Systemlightly.