Interview Questions

How do I convert a string to an int in C#?

C# Interview Questions and Answers


(Continued from previous question...)

123. 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);
}
}

(Continued on next question...)

Other Interview Questions