In this article, we will write a C# program to convert string to Integer using Convert.ToInt32() method
class Program
{
static void Main(string[] args)
{
string str1 = "5678";
string str2 = "567";
int i = Convert.ToInt32(str1);
int j = Convert.ToInt32(str2);
int k = i + j;
Console.WriteLine(k);
Console.ReadLine();
}
}
Output:
6245
Read more :
Source: csharpstar
The Tech platform
Comments