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

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

原文地址:https://www.cnblogs.com/zgqys1980/p/707087.html