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# int.Parse Method
Convert a string representation of number to an integer, using the int.Parse method in C#. If the string cannot be converted, then the int.Parse method returns an exception
Let’s say you have a string representation of a number.
string myStr = "200";
Now to convert it to an integer, use the int.Parse(). It will get converted.
int.Parse(myStr);
Example
using System.IO;
using System;
class Program {
static void Main() {
int res;
string myStr = "200";
res = int.Parse(myStr);
Console.WriteLine("String is a numeric representation: "+res);
}
}
Output
String is a numeric representation: 200
Advertisements
