When I use ToString with a Decimal in this way

    Decimal d = 1237129843M;
    string s = d.ToString("C");

the following way to parse string 's' do NOT work:

    Decimal r = Decimal.Parse(s);

indeed I get a FormatException.
To parse 's' I _have_ to do this way:

    Decimal r = Decimal.Parse(s, NumberStyles.Currency);

Why ToString and Parse methods of Decimal type are not symmetric?
I think this non symmetric design is a bad design because a programmer can
do a ToString while he only know how to specify a format string... then
when he want to parse the sting back he also have to know about
NumberStyles.

Can someone explain me this design decision?

TIA (luKa)
http://nullabletypes.sourceforge.net/

===================================
This list is hosted by DevelopMentor�  http://www.develop.com
NEW! ASP.NET courses you may be interested in:

2 Days of ASP.NET, 29 Sept 2003, in Redmond
http://www.develop.com/courses/2daspdotnet

Guerrilla ASP.NET, 13 Oct 2003, in Boston
http://www.develop.com/courses/gaspdotnet

View archives and manage your subscription(s) at http://discuss.develop.com

Reply via email to