Как мы можем преобразовать ее в необязательную цепочку, чтобы сократить код?
string textThree = ":)";
int intThree;
if(int.TryParse(textThree, out intThree))
{
Console.WriteLine($"Result Three using TryParse: {intThree}"); // prints 0
}
else
{
Console.WriteLine($"Not a number {textThree}"); // prints
}
Подробнее здесь: https://stackoverflow.com/questions/798 ... sharp-code
Мобильная версия