I am creating a windows application written in C#. I created a class Palette
which defines an enumerated type of property: direction {up, down, right, left}
. Inside another class of type Form1
I created an instance p
of Palette
.
Here is a simplified version:
namespace WindowsFormsApplication1
{
public class Palette
{
public Direction _direction
{
set { this._direction = value; }
get { return this._direction; }
}
}
public partial class Form1 : Form
{
private Palette p;
public enum Direction
{
Left, Right, Up, Down
}
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
p = new Palette { _direction = Direction.Up };
}
}
Then i think, p.direction should also be an enumerated type, is not it?
My software does not think that because I use it to compare p.direction! = Direction.up.
It thinks the type on the left is Palette._direction
. The right type is enum.
How can i do it?