C#中的函数参数能不能有默认值的解决方法

C#不支持参数默认值,如果要实现相同功能,可以使用函数重载的方法模拟实现。  
   
  如:   
   
void   MsgBox(string   msg,   string   title)  
  {  
            MessageBox.Show(msg,   title);  
  }  
   
  void   MsgBox(string   msg)  
  {  
          MsgBox(msg,   "消息");   //   "消息"   即是   title   参数的默认值。  
  }

posted @ 2007-04-10 14:28  dodo-yufan  阅读(9477)  评论(6编辑  收藏  举报