【发布时间】:2021-07-08 15:59:09
【问题描述】:
我有这个代码:
foreach (char ch in e.Text)
{
if (!Char.IsDigit(ch))
e.Handled = true;
else
{
if(!(ch.Equals(':')))
e.Handled = true;
}
}
当只有时
if (!Char.IsDigit(ch))
e.Handled = true;
我可以写数字,当我只使用第二个 if() 时,我只能写 ' : '。 但是当我同时使用它们时,我什么也写不出来。
【问题讨论】: