Link to home
Start Free TrialLog in
Avatar of mdaymond
mdaymond

asked on

accessing an enum from a separate class..

OK..  This should be pretty straight forward, but I am having problems.

I have a class something like this

     public class BLLLayer
     {
      public enum Temperature: int
            {
                  cold=1,
                  warm=2,
                  hot=3
            }
//more class stuff...

I want to be able to access the Temperature enum from another class as follows:

public class mytestclass
{
      BLLLayer bll = new BLLLayer();
      int i = bll.Temperature.cold;
      Console.WriteLine ("value is: " + i);
}

For whatever reason, I can't access my enum from the BLLLayer class....  Do I need accessor methods ??  What would they look like ?

Thanks
ASKER CERTIFIED SOLUTION
Avatar of TheAvenger
TheAvenger
Flag of Switzerland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial