Article Categories
- All Categories
-
Data Structure
-
Networking
-
RDBMS
-
Operating System
-
Java
-
MS Excel
-
iOS
-
HTML
-
CSS
-
Android
-
Python
-
C Programming
-
C++
-
C#
-
MongoDB
-
MySQL
-
Javascript
-
PHP
Selected Reading
C# Convert.ToInt32 Method
Use Convert.ToInt32 method to convert text to an integer.
Firstly, set a string.
string str = "12";
Now, use the Convert.ToInt32() method the above string to number.
Convert.ToInt32(str);
Let us see the complete example.
Example
using System;
class Program {
static void Main() {
string str = "12";
Console.WriteLine("String: "+str);
int n = Convert.ToInt32(str);
Console.WriteLine("Number: "+n);
}
}
Output
String: 12 Number: 12
Advertisements
