convert string to int tryparse csharp

Code Example - convert string to int tryparse csharp

                
                        bool successfullyParsed = int.TryParse(str, out ignoreMe);
if (successfullyParsed){
    // ...
}
                    
                
 

csharp tryparse int

                        
                                bool success = Int32.TryParse(value, out number);
         if (success)
         {
            Console.WriteLine("Converted '{0}' to {1}.", value, number);
         }
                            
                        
 

Related code examples