fork download
  1. using System;
  2.  
  3. public class Test
  4. {
  5. public static void Main()
  6. {
  7. int number;
  8. string sCarID="45";
  9.  
  10. bool result = Int32.TryParse(sCarID, out number);
  11.  
  12. if (result)
  13. {
  14. Console.WriteLine("Converted '{0}' to {1}.", "45", number);
  15. }
  16. else{
  17. Console.WriteLine("failed");
  18. }
  19. }
  20. }
Success #stdin #stdout 0.03s 33912KB
stdin
Standard input is empty
stdout
Converted '45' to 45.