Given the following ASP.NET code:
[System.Web.Script.Services.ScriptService]
public class Quotes : System.Web.Services.WebService
{
    [WebMethod]
    public void Calculate(int param1, int? param2)
    {
开发者_如何转开发etc..  How can I pass a null value to param2?  If I don't pass the parameter at all, or I pass undefined, my error handler fires with "Invalid web service call, missing value for parameter: 'param2'".
Ok I was being stupid. I simply pass null!
Why is null an object and what's the difference between null and undefined?
If you're using C# 4.0 you could set a default value on the parameter.
ie
[WebMethod]
    public void Calculate(int param1, int? param2 = null)
    {...}
 
         
                                         
                                         
                                         
                                        ![Interactive visualization of a graph in python [closed]](https://www.devze.com/res/2023/04-10/09/92d32fe8c0d22fb96bd6f6e8b7d1f457.gif) 
                                         
                                         
                                         
                                         加载中,请稍侯......
 加载中,请稍侯......
      
精彩评论