Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6583659
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T16:26:16+00:00 2026-05-25T16:26:16+00:00

Why decimal.Parse(10 10) is valid? I need to get exception in such case. Please

  • 0

Why decimal.Parse(10 10) is valid?
I need to get exception in such case.
Please advise me something.

decimal c;
try
{
   c = decimal.Parse("10 10");
   Console.Write(c);
   Console.ReadLine();
}
catch (Exception)
{
    throw;
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T16:26:17+00:00Added an answer on May 25, 2026 at 4:26 pm

    This throws an exception when I run it – which leads me to suspect that it’s culture-sensitive.

    My guess is that you’re in a culture which uses space as a “thousands” separator. For example, if I try to parse “10,10” that works because comma is the thousands separator in my default culture.

    To prevent this, use

    decimal value = decimal.Parse(text, NumberStyles.None);
    

    … or some other appropriate combination of NumberStyles which excludes AllowThousands.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Here's my problem (for en-US): Decimal.Parse(1,2,3,4) returns 1234, instead of throwing an InvalidFormatException. Most
What is the difference in C# between Convert.ToDecimal(string) and Decimal.Parse(string) ? In what scenarios
I need to round decimal numbers to six places using JavaScript, but I need
I'm trying to parse a string to a decimal and the parsing should failed
I'm writing an automation program to parse a tab-delimited file and write the data
Short question: Why are these ' ..... ' valid for parsing a decimal in
I am trying to parse a string like $45.59 into a decimal. For some
During a conversation on IRC, someone pointed out the following: decimal.Parse(1.0000).ToString() // 1.0000 decimal.Parse(1.00).ToString()
In my object conversion code I have tons of: try { NativeObject.Property1= int.Parse(TextObject.Property1); }
Possible Duplicate: C# Parse a Number from Exponential Notation I currently have: decimal value

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.