Q:

How to access nested namespaces to avoid the need to fully qualify in .NET

I feel like I'm missing something obvious here, but this issue has dogged me for some time.
I define some classes in a couple of different nested namespaces:
namespace Awesome.Example {

    namespace V1 {
        public class PopTart {
            public bool PoppinUp {get; set;}
            public bool Hot {get; set;}
        }
    }

    namespace V2 {
        public class PopTart {
            public bool PoppinUp {get; set;}
            public bool SoCool {get; set;}
            public bool AreHot {get; set;}
        }
    }

}

But if I try to simplify declaration with includes, the IDE (VS) complains that I need to fully qualify the classes.
For Example:
using Awesome.Example;

public class Main {

    public V1.PopTart Strawberry {get; set;}
    public V2.PopTart Blueberry  {get; set;}

}

This produces two errors:
The type or namespace name 'V1' could not be found (are you missing a using directive or an assembly reference?)
The type or namespace name 'V2' could not be found (are you missing a using directive or an assembly reference?)

I don't understand why this is.  Can anyone explain how to accomplish what I'm after?

A:

Try using namespace aliases like so:
using V1 = Awesome.Example.V1;
using V2 = Awesome.Example.V2;

public class Main
{
    public V1.PopTart p1 { get; set; }
    public V2.PopTart p2 { get; set; }

}

Or fully qualify your namespace like so:
public class Main
{
    public Awesome.Example.V1.PopTart p1 { get; set; }
    public Awesome.Example.V2.PopTart p2 { get; set; }
}

For further explanation and examples refer to the following question: Nested namespaces

