How to convert string with numbers to integer (int) number in C#

1 Answer

0 votes
using System;

namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {
            string s = "1234";
            
            int i = int.Parse(s);
            Console.WriteLine(i); // 1234

            i++;
            Console.WriteLine(i); // 1235

        }
    }
}

/*
run:
 
1234
1235

*/


answered Feb 15, 2015 by avibootz

Related questions

1 answer 267 views
1 answer 170 views
1 answer 96 views
1 answer 105 views
1 answer 175 views
...