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 371 views
1 answer 263 views
1 answer 222 views
1 answer 208 views
1 answer 286 views
2 answers 325 views
325 views asked May 10, 2018 by avibootz
...