[Mono-list] Argh... ECMA & MS (was: Number style / format stuff)
Derek Holden
dsh2120@draper.com
Thu, 20 Sep 2001 15:11:25 -0400
Hey Miguel,
I've been working with the IFormattable, NumberFormatInfo, and data types
for a bit now and going 90% off the ECMA docs. All the data types implement
IFormattable so they all have a ToString(), ToString(string format), and
ToString(string format, NumberFormatInfo). The data types in the docs define
the behavior for them, such as Int32's ToSting() is the equivalent of
calling, ToString("G", null). The IFormattable interface defines what to do
for each type for each format. The behavior for what should happen when you
enter n.ToString() is laid out, it just trips over itself in a couple places
and MS' implementation walks around it. Nothing new, just another case of us
trying to follow.
As far as the Console.WriteLine, it's actually a good thing. I built a
library using the mcs' data types and number formatter, then used that
alongside csc's corlib. You can see microsoft's Console.WriteLine("{0}", n)
using our n and falling through to our Formattable interface, and even
working in some cases ;). I'm getting ready to submit some of it so people
can get a feel for it.