They are different methods with different uses, 
.TosTring exists to format a Decimal to a string
.Parse ends up calling .ParseDecimal which returns a decimal value

-----Original Message-----
From: Luca Minudel [mailto:[EMAIL PROTECTED]
Sent: 02 September 2003 09:05
To: [EMAIL PROTECTED]
Subject: Re: [ADVANCED-DOTNET] ToString and Parse design question


I can agree with you Gaurav and Robin but I think that there are two other
options that make ToString and Parse more symmetric:

1) do not accept "C" format for a Decimal, that is Decimal.ToString("C")
should throw a FormatException as it do for "R", "X", etc.

2) actually Decimal.Parse(string) implementation uses NumberStyles.Number
(that's 0x6F = 111), it should use NumberStyles.Number |
NumberStyles.AllowCurrencySymbol (that's 0x16F = 367).

IMHO I prefer solution n.1.
What you think? Why MS made a different design decision?

TIA (luKa)


On Tue, 2 Sep 2003 14:02:18 -0400, Gaurav Khanna <[EMAIL PROTECTED]>
wrote:
>...But presumbly,
>passing a different number styles brings a lot of difference, considering
>that the default assumption of the style is that as a "Number" and not
>"Currency".
>

On Tue, 2 Sep 2003 13:04:31 -0500, Robin Debreuil <[EMAIL PROTECTED]>
wrote:
>I would say making you specify all this is a better behaviour
>than 'best guess' in this case.
>

===================================
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
**************************************************************************************************************************
Everything in this e-mail and attachments relating to the official business of 
MultiChoice Africa is proprietary to 
the company. Any view or opinion expressed in this message may be the view of the 
individual and should not automatically 
be ascribed to the company.  If you are not the intended recipient, you may not 
peruse, use, disseminate, distribute or 
copy this message. If you have received this message in error, please notify the 
sender immediately by email, facsimile 
or telephone and destroy the original message.
**************************************************************************************************************************

===================================
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