I am using C # in VS2005. I have a class library that contains several enumerations common to a number of different projects. When accessing one of these enumerations, I need to specify the entire namespace path to the enumeration, even if I declared the "using" directive for the namespace containing the enumeration.
For example, I have the following enumeration:
namespace Company.General.Project1
{
public static class Rainbow
{
[Flags]
public enum Colours
{
Red,
Blue,
Orange
}
}
}
Then in another project I have:
using Company.General.Project1;
namespace Company.SpecialProject.Processing
{
public class MixingPallette
{
int myValue = Company.General.Project1.Colours.Red;
}
}
Despite the fact that I have a 'Using' directive that references a project that contains an enumeration class, I still have to write enum longhand.
Why can't I do the following ...
using Company.General.Project1;
namespace Company.SpecialProject.Processing
{
public class MixingPallette
{
int myValue = Colours.Red;
}
}
source
share