当前位置:首页
开发技术指南» 文章正文
    引言:

    摘要: http://grad.njnu.edu.cn上的图片有两个错误,一个是scool要改一下,一个是网址在改为http://grad.njnu.edu.cn,有没有哪位老兄指点一下 ......
 ·建数据库问题加field    »显示摘要«
    摘要: 各位大虾: 小弟的一段代码请大虾看看,一执行到add(receive,ftboolean,1,true); 出现invalid filed size,请问这个ftboolean,和ftinteger的size是什么,其中integer我只要有个位数就行了? 代码: with ttable.create(self) do begin databasename:=e:\delphi_20\pr......


有懂C#的大侠,请帮我将下列PHP代码转换为C#相对应的代码

有篇文章是用PHP写的,可惜我看不懂有些代码,烦请帮我将下列代码转换为C#相对应的代码!  
   
  有答必给分!!谢谢谢谢  
   
  1. var   $body_temp=array();  
  2. var   $month_num=array(“Jan”=>1,”Feb”=>2,”Mar”=>3);  
  3. function   aa($head=null,$body=null,$content_num=-1){  
                              if(!$head   and   !$body)     //????????  
                    }  
  4. unset($this->body_temp);  
  5. if(!eregi(“multipart”,$this->body_type))  
  6. $tmp_body=implode($this->body_temp,”\r\n”);  
  7. $this-body=array();  
                    $this->body[$this->tem_num][content_id]=””;  
                    $this->body[$this->tem_num][type]=$this->body_type;  
  8. $lines=count(this->body_temp);  
  9. eregi($boundary.”--”,$this->body_temp[$i]);  
  10. eregi(“Content-ID:[   ]*\<(.*)\>”,$comm.,$reg);  
  11. $content.=$this->body_temp[$I].”\r\n”;  
   
  补充一句,各代码行相互独立!!  
 

NO.1   作者: alexxing

1. var   $body_temp=array();  
  PHP是弱类型语言,C#是强类型语言,所以这句对应的C#不确定  
  如果   body_temp   元素类型未知:  
   
  object[]   body_temp   =   new   object[0]   {};  
   
  object   是   C#   的公共基类  
   
  如果   body_temp   元素类型已知:  
   
  int[]   body_temp   =   new   int[0]   {};  
   
  2. var   $month_num=array(“Jan”=>1,”Feb”=>2,”Mar”=>3);  
   
  C#   的数组都是整数下标的,这句在C#中没有直接对应的,只能用两个数组模拟:  
   
  string[]   month_num_idx   =   new   string[3]   {   "Jan",   "Feb",   "Mar"   };  
  int[]   month_num_val   =   new   int[3]   {   1,   2,   3   };  
   
  而且定位元素时还要加一些算法  
   
  3. function   aa($head=null,$body=null,$content_num=-1){  
                              if(!$head   and   !$body)     //????????  
                    }  
   
  C#   没有孤立的函数,只有类方法,可以用“静态”方法模拟:  
   
  public   class   Test  
  {  
          public   static   aa(object   head,   object   body,   int   content_num)  
          {  
                  //不知道你的   head,   body   的具体类型,PHP的布尔“真”“假”值与C#的含义不同,所以对应代码不好写  
          }  
  }  
   
  4. unset($this->body_temp);  
   
  C#   无所谓   unset,因为PHP是解释语言,而C#是编译语言  
   
  5. if(!eregi(“multipart”,$this->body_type))  
   
  手头没有手册,不知道   eregi   对应的   C#   方法,$this->body_type   应该对应   this.body_type  
   
  6. $tmp_body=implode($this->body_temp,”\r\n”);  
   
  不知道   implode   对应的   C#   函数  
   
  7. $this-body=array();  
                    $this->body[$this->tem_num][content_id]=””;  
                    $this->body[$this->tem_num][type]=$this->body_type;  
  8. $lines=count(this->body_temp);  
   
  lines   =   this.body_temp.Length;  
   
  9. eregi($boundary.”--”,$this->body_temp[$i]);  
  10. eregi(“Content-ID:[   ]*\<(.*)\>”,$comm.,$reg);  
  11. $content.=$this->body_temp[$I].”\r\n”;  
   
  假设   this->body_temp[I]   已经是   string   类型:  
   
  content   =   content   +   this->body_temp[I]   +   "\r\n";  
 


    摘要: 老师: 你好 能够在您百忙之中抽出时间帮助我,在此表示由衷的感谢. 问题1: 在dbgrid中在一行中左右移动会触发oncolexit,oncolenter,但要是上下移动就不知触发什么了。 因为我的程序是想在离开dbgrid中的某个小格时,对在同一行中的几个字段进行一次计算,我 左右移动时,能够触发我放在oncolexit中的计算代码,但如果我上下移动或其它方式离开这个 字段时,就没......
» 本期热门文章:

©2000-2007 All Rights Reserved. 最佳浏览:1024X768 MSIE