为什么你要设置一个函数来检查 startDate< endDate
是否已经启动?
private void button1_Click(object sender, EventArgs e)
{
DateTime startDate = new DateTime(2012 , 05 , 25);
DateTime endDate = new DateTime(2012 , 05 , 31);
bool rtnval = IsValidDate(startDate, endDate);
}
public bool IsValidDate(DateTime startDate, DateTime endDate)
{
return startDate < endDate && endDate > startDate;
}
这个代码是真实的!
拆分并检查您是否拥有您想要的值
public bool IsValidDate(DateTime startDate, DateTime endDate)
{
bool resulta = startDate < endDate; // break here
bool resultb = endDate > startDate; // break here
return startDate < endDate && endDate > startDate;
}
/ O O O O Os I didn't realize it 被解答了 / OOs I didn't realize its answer