How to determine if a number is an integer | Sololearn: Learn to code for FREE!
Новый курс! Каждый программист должен знать генеративный ИИ!
Попробуйте бесплатный урок
0

How to determine if a number is an integer

Help.

2nd Aug 2020, 10:48 PM
Yellow Keys
Yellow Keys - avatar
1 ответ
+ 2
Last option is no typical or valid C# option. Try to parse it into an integer and if you go to catch block, it was not an integer... string b = "1"; try { int c = Int32.Parse(b); Console.WriteLine("true"); } catch (Exception e) { Console.WriteLine("false"); }
2nd Aug 2020, 11:17 PM
Sandra Meyer
Sandra Meyer - avatar