C# (Sharp) Programming Language Question:
Download Questions PDF

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

Answer:

Here's an example: using System;
class StringToInt
{
public static void Main()
{
String s = "105";
int x = Convert.ToInt32(s);
Console.WriteLine(x);
}
}

Download C# (Sharp) Programming Language Interview Questions And Answers PDF

Previous QuestionNext Question
Why do I get an error (CS1006) when trying to declare a method without specifying a return type?How do you directly call a native function exported from a DLL?