[Gtk-sharp-list] Gdk.Color, further comments.
Jonathan Pryor
jonpryor@vt.edu
28 Feb 2003 17:56:50 -0500
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.
- Jon
On Fri, 2003-02-28 at 17:39, Lee Mallabone wrote:
> On Fri, 2003-02-28 at 20:51, Miguel de Icaza wrote:
>
> > Further comments on Gdk.Color. I do not feel strongly about some of
> > these, but I would like to have a discussion on them:
> >
> > * Gdk.Color.Parse returns an int indicating whether it succeeded
> > or not. Can we map the return value to bool?
>
> How about having a void return type and throwing an exception if the parse failed?
> I'm not sure if that's any easier to do than returning a bool, but it seems like a better use of the c# language features than having to check the return value.
>
> Regards,
>
> Lee.
>
>
> _______________________________________________
> Gtk-sharp-list maillist - Gtk-sharp-list@lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/gtk-sharp-list