Help with C# get{} and set{} using structs?

Kc F

New member
I am having a problem with get{} and set{} in C# (it's for a custom control). Generally, if I declare a variable, it shows up in the property box as expected, and can be set accordingly. If, however, I create a struct, it simply refuses to let me edit the fields. My code is as follows:

public struct myInts
{
private int myX, myY, myZ;

public myInts(int x, int y, int z)
{
myX = x;
myY = y;
myZ = z;
}

public int X
{
get { return myX; }
set { myX = value; }
}
public int Y
{
get { return myY; }
set { myY = value; }
}
public int Z
{
get { return myZ; }
set { myZ = value; }
}

public override string ToString()
{
return (myX + ", " + myY + ", " + myZ);
}
}

private myInts integers = new myInts(1, 2, 3);
public myInts MyIntegers
{
get { return integers; }
set { integers = value; }
}

It is displayed in the property box, but cannot be expanded and cannot be edited. Any help will be much appreciated
 
Back
Top