Home All Groups Group Topic Archive Search About

int.Parse and NumberStyles.AllowParentheses

Author
26 Apr 2007 11:46 AM
bernhard
Hi,

Just a quick question: How come that using int.Parse("(20),
NumberStyles.AllowParenthesis" ); returns a negative value?

I would definetly expect that call to return something positive.

Thanks, Bernhard.

Author
26 Apr 2007 12:09 PM
Cowboy (Gregory A. Beamer)
If you look at standard numbering, in apps like Excel, negative numbers can
take one of the following formats:

-20
(20)

The same methodology has been put into .NET.

--
Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA
http://gregorybeamer.spaces.live.com

*********************************************
Think outside the box!
*********************************************
Show quote
"bernhard" <bernh***@discussions.microsoft.com> wrote in message
news:1C993A9C-B769-4157-8A2E-71943C3F24AE@microsoft.com...
> Hi,
>
> Just a quick question: How come that using int.Parse("(20),
> NumberStyles.AllowParenthesis" ); returns a negative value?
>
> I would definetly expect that call to return something positive.
>
> Thanks, Bernhard.
Author
1 May 2007 4:12 PM
Rad [Visual C# MVP]
On Thu, 26 Apr 2007 04:46:01 -0700, bernhard wrote:

> Hi,
>
> Just a quick question: How come that using int.Parse("(20),
> NumberStyles.AllowParenthesis" ); returns a negative value?
>
> I would definetly expect that call to return something positive.
>
> Thanks, Bernhard.

Parenthesizing negative numbers is an accounting principle, that can be
utilized in the .NET Framework
Author
1 May 2007 4:25 PM
bernhard
This still does not make sense because you do not expect something general as
int.Parse()/NumberStyles.* to be accounting specific.

But thanks for the explanation. I can now see where it originates from.
Thanks, B.

Show quote
"Rad [Visual C# MVP]" wrote:

> On Thu, 26 Apr 2007 04:46:01 -0700, bernhard wrote:
>
> > Hi,
> >
> > Just a quick question: How come that using int.Parse("(20),
> > NumberStyles.AllowParenthesis" ); returns a negative value?
> >
> > I would definetly expect that call to return something positive.
> >
> > Thanks, Bernhard.
>
> Parenthesizing negative numbers is an accounting principle, that can be
> utilized in the .NET Framework
> --
> Bits.Bytes
> http://bytes.thinkersroom.com
>

AddThis Social Bookmark Button