sahu Profile Answers by sahu Questions by sahu Jan 6th, 2006 Ans:by using onvert.ToInt32(string)ExampleString s = "45";int x = Convert.ToInt32(s);
Viktor Toman Profile Answers by Viktor Toman Apr 13th, 2011 One more way:String str = "123";Int32 num;Boolean converted = Int32.TryParse(str, out num);
How do I convert a string to an int in C#?
Here's an example: using System;
class StringToInt
{
public static void Main()
{
String s = "105";
int x = Convert.ToInt32(s);
Console.WriteLine(x);
}
}
Related Answered Questions
Related Open Questions