[Mono-list] new color.cs for inclusion in CVS

Ben Houston ben@exocortex.org
Wed, 6 Mar 2002 18:30:43 -0500

Hi Dennis,

Many of your constructors look like the following:
> 		public static Color FromArgb (int a,int r, int g, int b)
> 		{
> 			return new Color (a,r,g,b);
> 		}

The above may be really slow since it could require a box/unbox
operation to the struct when using the new operator (i.e. remember that
we are not using classes).  Although, I find that I am sometimes wrong
about this stuff so maybe someone should check my facts. ;-)
I would have written it like this instead:
> 		public static Color FromArgb (int a,int r, int g, int b)
> 		{
>			Color color;
>			color.a = a;
>			color.r = r;
>			color.g = g;
>			color.b = b;
>			return	color;
> 		}

-ben houston
4th Year Cognitive Science/Neuroscience
Carleton University, Ottawa, Canada
( ben@exocortex.org / 613-266-0637 )

> -----Original Message-----
> From: mono-list-admin@ximian.com [mailto:mono-list-admin@ximian.com]
> Behalf Of Dennis Hayes
> Sent: Wednesday, March 06, 2002 3:50 PM
> To: 'mono-list@ximian.com'
> Subject: [Mono-list] new color.cs for inclusion in CVS
> Here is a decent start on the Color structure for
> I plan to finish this and the System.Drawing.KnownColor structure in
> next few days.
> Could someone (mkestner?) put this in CVS for me?
> This compiles using Visual Studio, and passes some simple test.
> Will also try to add tests to nunit in next few days as well.
> Thanks.
> Dennis