mitesh114
asked on
C# Get and Set methods
Hi,
I have a class called Settings and I have this method in there:
public enum Scope
{
scopeone = 0,
scopetwo = 1,
scopethree = 2
}
public Settings.Scope SelectScope
{
get{ return _selectScope; }
set{ _selectScope = value; }
}
I then have another method called MessageBox in which I want to display the scope value picked up from the dropdown. How do I do this?
I have a class called Settings and I have this method in there:
public enum Scope
{
scopeone = 0,
scopetwo = 1,
scopethree = 2
}
public Settings.Scope SelectScope
{
get{ return _selectScope; }
set{ _selectScope = value; }
}
I then have another method called MessageBox in which I want to display the scope value picked up from the dropdown. How do I do this?
MessageBox.Show(Enum.GetNa me(typeof( Scope), _selectScope);
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
thanks for your help
No problem, thanks too!
{
//For testing purposes:
_selectScope = Scope.scopeone;
MessageBox.Show(_selectSco
}
.ToString() will give a string name of the enum. If you want the original number, you will have to create your own ToString() function and output the numeric value.