New and old way to parse an int : Convert from string : Data Type C# Examples


C# Examples » Data Type » Convert from string »

 

New and old way to parse an int









    
using  System;
using  System.Collections.Generic;
using  System.Diagnostics;
using  System.Runtime.CompilerServices;

public  class  MainClass
{

        public  static  void  Main()
        {
                
                int  parsedQty  =0;
                try
                {
                        parsedQty  =  int.Parse("123");
                }
                catch  (FormatException)
                {
                }

                
                if  (!int.TryParse("123",  out  parsedQty))
                {
                }
        }
}
    
   
  
   




HTML code for linking to this page:

Follow Navioo On Twitter

C# Examples

 Navioo Data Type
» Convert from string