Click here to Skip to main content
14,733,444 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Application["ApplicationVisitorCount"].ToString() in Global.asax file.

I want to convert it into integer.
Updated 8-Jun-18 1:19am

There are several ways to cast,
For e.g
string s = "123";

int byCasting = (int)s;
int byParsing = int.Parse(s);

int result;
int.TryParse(s,out result);

int byConverting = Convert.ToInt32(s);

But among of all I think the TryParse is best.

Please vote and Accept Answer if it Helped.
Try Integer.Parse() or Integer.TryParse()

Good luck!
string num = "123";
int parse =int.Parse(num);

Convet.ToInt32 will not throw null exceptions

Hope this will help you :)

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900