T
Tony Johansson
Hello!
Here I have some simple code below that I have run into. I have never seen
this construction before.
I have two questions about it.
My first question is: Can somebody explain how this work. Here the enum type
Cars is the same as
the property name Cars.
My second question is: Why is it not possible to step into the property Cars
when I do
myCar.val = (Cars)7;
in main
enum Cars {Volvo,Saab,Opel }
struct Car
{
public Cars val;
public int Cars
{
get { return 100; }
}
}
static void Main(string[] args)
{
Car myCar;
myCar.val = (Cars)7;
}
//Tony
Here I have some simple code below that I have run into. I have never seen
this construction before.
I have two questions about it.
My first question is: Can somebody explain how this work. Here the enum type
Cars is the same as
the property name Cars.
My second question is: Why is it not possible to step into the property Cars
when I do
myCar.val = (Cars)7;
in main
enum Cars {Volvo,Saab,Opel }
struct Car
{
public Cars val;
public int Cars
{
get { return 100; }
}
}
static void Main(string[] args)
{
Car myCar;
myCar.val = (Cars)7;
}
//Tony