您的位置:程序门 -> .net技术 -> c#



c#初学者问题


[收藏此页] [打印本页]选择字色:背景色:字体:[][][]


c#初学者问题
发表于: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的值呀,这种值为什么能相互转换而被接收啊,是不是隐藏一些什么要的东西啊,是不是自动转换呀,这属于什么物性啊,
发表于:2007-02-20 21:06:581楼 得分:0
日期,.net   里面,直接可以加减,得到另一个   timespan   对象
   

发表于:2007-02-21 18:50:592楼 得分:0
up


快速检索

最新资讯
热门点击