最好的方法是什么?
这就是我通常会这样做的方式:
DateTime newDate; try { newDate = DateTime.Parse(Textbox.Text); } catch { //isn't a datetime return; } //do stuff with the date
但有些事情告诉我,这有点不对劲.有任何想法吗?
c#
c# ×1