Getting Started with Adobe After Effects - Part 6: Motion Blur
A collection of quick technology learning tips from what people around you learn every day

Best Practice to make numeric conversion using Tryparse method

Aug 5 2011 8:28AM by Kirti M.Darji   

Many developers will face problem when converting string to particular numeric datatype. Some times it will give error if string is non numeric. Non numeric string means, it may contain any extra string character or may be white space with numeric value. In that case it give error like "Input string was not in a correct format" We overcome this problem by using TryParse method for numeric datatype conversion of like int,decimal,long etc. See below example

{   int I = 0;
        if (int.TryParse("25", out I))
                Response.Write(string.Format("Value of I is={0}", I.ToString()));
    }

Thank You

Read More..   [32134 clicks]

Published under: Microsoft .NET Tips ·  ·  ·  · 


Kirti M.Darji
10 · 16% · 4980
2
 
2
 
 
0
Incorrect
 
0
Interesting
 
0
Forgotten



Submit

Your Comment


Sign Up or Login to post a comment.

"Best Practice to make numeric conversion using Tryparse method" rated 5 out of 5 by 2 readers
Best Practice to make numeric conversion using Tryparse method , 5.0 out of 5 based on 2 ratings
    Copyright © Rivera Informatic Private Ltd Contact us      Privacy Policy      Terms of use      Report Abuse      Advertising      [ZULU1097]