下面是使用Int32.TryParse与if条件我的一段代码。(控制台应用程序) Console.WriteLine("Enter the no of the person(value for n)");
string number = Console.ReadLine();
Console.WriteLine("Enter the no of the bulb whose state
我的程序包含一个文本框。 我需要检查它是否只有数字,然后打印。 int num;
if (this.Tree.GetType() == Main.TestInt.GetType())
{
if (int.TryParse(this.label.Text,out num) == true) // i tried without the == before
这里是我的代码: DateTime Dob = Convert.ToDateTime("1/1/1800");
DateTime Dod = Convert.ToDateTime("1/1/1800");
if (!DateTime.TryParse(p.birthday, out Dob) && !DateTime.TryParse(p.deathday, ou
在我的应用程序中,我有一个文本框 - txtDiscount,管理员可以为某个用户设置折扣百分比,或者他可能不会。在后端我要保存的数据,所以现在我有这样的: double? discount = null;
if (!string.IsNullOrEmpty(txtDiscount.Text))
{
if (!double.TryParse(txtDiscount.Text, out