1
Answer

How do I convert string to integers?

Please see this code snippet and tell me what to do

using System;

class me
{
public static void Main()
{
string one;
int a;
one=Console.ReadLine();
a=(int)one;
Console.WriteLine(a);
}
}

the code gives an error. I want to convert it to an integer without using Convert.ToInt32() method. I am trying to convert it explicitly. Is there no other way apart from Convert.ToInt32()?

Answers (1)