You cannot do what you want to do, at least, not directly.
The Color type is a struct
. It's a value type. Each instance of Color
is a separate copy of the value. It is not possible to get two Color
instances to refer to the same object, any more than it is possible for two int
instances to refer to the same object.
Now, you might be able to hack something by including the Color
within your own class. The following has not been tested:
public class ColorByReference
{
Color TheColor {get;set;}
}
static ColorByReference color = new ColorByReference {Color = new Color(0,0,0,0)};
static void Main(string[] args)
{
ColorByReference otherColor = color;
color.TheColor.B = 100;
Console.WriteLine(otherColor.TheColor.B);
Console.WriteLine(color.TheColor.B);
Console.ReadLine();
}