I have a class called Surface, in this class i have an array of type struct Color.
public class Surface
{
private Color[,] pixels;
public Color this[int x, int y]
{
get { return pixels[y, x]; }
}
}
[StructLayout(LayoutKind.Explicit)]
public struct Color
{
[FieldOffset(0)]
public byte R;
public void Set(byte r)
{
R = r;
}
}
However when i try to access the color using the indexer it don't get updated.
mySurface[x, y].Set(255); // Will not work, i don't get an error but the color don't get updated.
How can i solve this problem?