[Gtk-sharp-list] Gdk.Color, further comments.

Gonzalo Paniagua Javier gonzalo@ximian.com
01 Mar 2003 02:27:27 +0100


El vie, 28 de 02 de 2003 a las 23:56, Jonathan Pryor escribió:
> Shouldn't we be aiming for conformity/consistency with the rest of the
> API?  This would dictate a return value of Gdk.Color and throwing an
> exception on error:
> 
> 	public static Gdk.Color Parse (string s)
> 	{
> 		GdkColor ret_color;
> 		int raw_ret = gdk_color_parse(spec, out ret_color);
> 		if (raw_ret == 0)
> 			// Adjust type as necessary...
> 			throw new Exception ("Invalid color");
> 		return ret_color;
> 	}
> 
> However, this would probably need to be done through a Color.custom file
> instead of through the API generator.

In that case, I'd also add a TryParse that returns a bool and an out
Gdk.Color, just in case someone doesn't want to have a try/catch block.

-Gonzalo