我写了一个带有可选参数的网络方法。
[WebMethod]
public void EmailSend(string from, string to, string cc = null, string bcc = null, string replyToList = null, string subject = null, string body = null, bool isBodyHtml = false , string[] attachmentNames = null, byte[][] attachmentContents = null)
{
.....
}
我在客户端应用程序中调用此方法
EmailServiceManagement.EmailService es = new EmailServiceManagement.EmailService();
es.EmailSend(from, to,null,null,null,subject,body,true,attName,att); //this works
但
es.EmailSend(from,to); // this isn't working. According to c# optional parameter syntax it must work.
我究竟做错了什么?