I need to create a type that contains a few methods and a long list of constants.
After a little research, I think I'd like to take the same approach taken by the System.Drawing.Color
struct. However, looking at the source for this structure (generated from meta data) gives me something like the following.
public byte A { get; }
public static Color AliceBlue { get; }
public static Color AntiqueWhite { get; }
public static Color Aqua { get; }
public static Color Aquamarine { get; }
public static Color Azure { get; }
public byte B { get; }
// ...
Can anyone explain to me how the static Color values (which are the same type as the containing struct) ever get initialized? I must be missing something.
If you look at the
Color
class with Reflector you will see:That confirms that a new
Color
object is returned every time.