Home » Tutorials » C# » NumberStyle in Parse() and TryParse() in C#

NumberStyle in Parse() and TryParse() in C#

Difference between JSON.stringify() and JSON.parse() in JSON - JavaScript
Capitalize First Letter of each Words of string in C#

NumberStyle in Parse() and TryParse() in C#

Hello folks, today we will learn about NumberStyle in Parse() and TryParse() in C# using examples one by one by taking one by one NumberStyles as shown in below image. So let’s try to understand NumberStyle in Parse() and TryParse() in C#.


1. NumberStyles.None

This Number style will permit only Integer as shown below example.


2. NumberStyles.AllowDecimalPoint

This NumberStyle also allowed decimal values to convert into integer, else conversion will thrown an exception as System.FormatException: ‘Input string was not in a correct format.’ shown below example:

3. NumberStyles.AllowExponent & NumberStyles.Float


4. NumberStyles.AllowLeadingSign &  NumberStyles.AllowLeadingWhite & NumberStyles.AllowTrailingWhite &  NumberStyles.AllowParentheses


5. NumberStyles.AllowThousands


6. NumberStyles.AllowCurrencySymbol




Hello friends, My self Dhruv Sheth, I have more than 6 years of Industrial experience as a Software Developer. In my career I got chance to work with asp.net, c#,Web API, JavaScript, JQuery, WPF, WCF , Windows Application, PostScript, vb.net, GhostScript etc. So I have decided to share my knowledge with everyone and finally I have come up with TechnoThirsty.

One thought on “NumberStyle in Parse() and TryParse() in C#

  1. Wilfred Moses says:

    Great information. Since last week, I am gathering details about the C# experience.
    There are some amazing details on your blog which I didn’t know. Thanks.

Leave a Reply

Your email address will not be published. Required fields are marked *


Time limit is exhausted. Please reload CAPTCHA.

The content is copyrighted to technothirsty.com and may not be reproduced on other websites without permission from the owner.You may contact us using the information below.