| 发表于:2007-02-20 19:22:07 楼主 |
private int compare_click(object sender, system.eventargs e) { int diff = datecompare(first.value, second.value); info.text = " "; show( "first == second ", diff == 0); show( "first != second ", diff != 0); show( "first < second ", diff < 0); show( "first <= second ", diff <= 0); show( "first > second ", diff > 0); show( "first > = second ", diff > = 0); } 在datecompare方法主体中输入以下语句: private int datecompare(datetime lefthandside, datetime righthandside) int result; if (lefthandside.year < righthandside.year) result = -1; else if (lefthandside.year > righthandside.year) result = +1; else if (lefthandside.month < righthandside.month) result = -1; else if (lefthandside.month > righthandside.month) result = +1; else if (lefthandside.day < righthandside.day) result = -1; else if (lefthandside.day > righthandside.day) result = +1; else result = 0; return result; 问题:first.value是属性吗?这个实参在传入datetime lefthandside,中的lefthandside,这个变量为什么能接收好多种种类,如day,month的值呀,这种值为什么能相互转换而被接收啊,是不是隐藏一些什么要的东西啊,是不是自动转换呀,这属于什么物性啊, |
|
|
|
|