[prev in list] [next in list] [prev in thread] [next in thread] 

List:       mono-gtk-sharp-list
Subject:    Re: [Gtk-sharp-list] Idea: ToString() methods
From:       Miguel de Icaza <miguel () ximian ! com>
Date:       2002-08-19 19:10:20
Message-ID: 1029784219.19975.69.camel () erandi ! boston ! ximian ! com
[Download RAW message or body]

Hello,

> How about trying to stay "compatible" with the output of the classes in
> the System.Drawing namespace?
> 
> On MS.NET:
> 
> Console.WriteLine(new System.Drawing.Point(1,2).ToString());
> Console.WriteLine(new System.Drawing.Rectangle(1,2,3,4).ToString());
> Console.WriteLine(System.Drawing.Color.Blue.ToString());
> Console.WriteLine(System.Drawing.Color.FromArgb(100,100,100).ToString())
> ;
> 
> Prints out this:
> 
> {X=1,Y=2}
> {X=1,Y=2,Width=3,Height=4}
> Color [Blue]
> Color [A=255, R=100, G=100, B=100]

Well, there is a problem here.  ToString() is officially documented in
the Object base class as being just a debugging tool, and not intended
to be used for real use.  A few classes though, use ToString() as their
officially supported method of stringifying themselves (like
StringBuilder.ToString).

So in the above scenario, ToString() looks like debugging, but in the
Gtk# case, we could make it a bit more useful.  For instance, the rgb:
notation from X11 can be copy/pasted in source code or program command
lines, or input fields to specify a color.

I do not feel strongly about this though.

Miguel


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic