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 8477527
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T18:29:30+00:00 2026-06-10T18:29:30+00:00

i have value stored in string format & i want to convert into decimal.

  • 0

i have value stored in string format & i want to convert into decimal.

ex:

i have 11.10 stored in string format when i try to convert into decimal it give me 11.1 instead of 11.10 .

I tried it by following way

string getnumber="11.10";
decimal decinum=Convert.ToDecimal(getnumber);

i tried this also

decinum.ToString ("#.##");

but it returns string and i want this in decimal.

what could be the solution for this?

  • 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-06-10T18:29:32+00:00Added an answer on June 10, 2026 at 6:29 pm

    As already commented 11.1 is the same value as 11.10

    decimal one=11.1;
    decimal two=11.10;
    Console.WriteLine(one == two);
    

    Will output true

    The # formatter in the to string method means an optional digit and will supress if it is zero (and it is valid to suppress – the 0 in 4.05 wouldn’t be suppressed). Try

    decinum.ToString("0.00"); 
    

    And you will see the string value of 11.10

    Ideally you actually want to use something like

    string input="11.10";
    decimal result;
    
    if (decimal.TryParse(input,out result)) {
       Console.WriteLine(result == 11.10);
    } else {
      // The string wasn't a decimal so do something like throw an error.
    }
    

    At the end of the above code, result will be the decimal you want and “true” will be output to the console.

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

Sidebar

Related Questions

I have a String stored in a table in the following key-value format: Key1☺Value1☺Key2☺Value2☺KeyN☺ValueN☺.
I have a String that represents a time value and is stored in the
I have a variable newItem. I want to place the value stored in newItem
I have JSON data stored in a DB table in string format. Requirement is
I have a date that is stored as a string in the format YYYYDDMM.
I have a clr stored procedure that has to return decimal value. I cannot
I have the following packet format: 1B 4B 1B 1B string 2 bytes 1B
I have a std::map<std::string, HANDLE> SampleMap which stores HANDLE objects as value. After the
I'm converting a D2006 program to D2010. I have a value stored in a
I have a pretty basic doubt on dirty read/writes to a value stored in

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.