so I was just starting to code and found out that this example right here doesn't work, but with int.TryParse() it would work. Otherwise with Convert.Byte() it works too. What is the background of that?
using System;
namespace timezones
{
class Program
{
static void Main(string[] args)
{
int timeSwitzerland = Convert.ToInt(Console.ReadLine());
}
}
}
As I'm seeing this quite often, I'll post the official string to number conversion guide
So effectively in both cases you use
Int.Parse
Now in your case the options are
Convert.ToInt{Enter extected integer size}
: