I have a project in MS Visual Studio 2008 Pro. I'm new to the environment and the language, so forgive a noobish question.
I have a type ControlCode
:
namespace ShipAILab
{
public abstract class ControlUnit {
public enum ControlCode {
NoAction = 0x00,
MoveLeft = 0x01,
MoveUp = 0x02,
MoveRight = 0x04,
MoveDown = 0x08,
Fire = 0x10,
}
}
}
I want this to be accessible from another class, BoardUtils
, which is in the same ShipAILab
namespace:
public static IList<ControlUnit.ControlCode> pathToPoint(IDictionary<CompPoint, int> dist, CompPoint destination) {
ControlUnit.ControlCode code = ControlUnit.ControlCode.MoveLeft; // works
ControlCode c2 = ControlCode.MoveDown; // how do I get this to work?
}
Why doesn't this work automatically, by virtue of sharing a namespace? Do I need a using
statement? Can I "typedef" it like in C to rename ControlUnit.ControlCode
to something more concise?