【问题标题】:Why do these parameters not work?为什么这些参数不起作用?
【发布时间】:2012-06-08 01:52:29
【问题描述】:
public static string ChangeDeviceState(int deviceID, DeviceState nextState)
{
    bool temp1;
    string temp = "";
    return ChangeDeviceState(deviceID, nextState, temp1, temp, "", "", "", "", ""); 
}

public static string ChangeDeviceState(int deviceID, DeviceState nextState, out bool? isAccessToken, out String challengeOrToken, string accessToken, string serialNumber, string MACAddress, string deviceModel, string answer )
{

我想做的只是有另一种方法,不需要其他参数。 I bool isAccessToken 必须可以为空,challengeOrToken 必须是输出参数。

我收到一个非法参数错误。

我真的不明白c#中的这些参数特性。任何帮助是极大的赞赏。

【问题讨论】:

    标签: c# nullable out


    【解决方案1】:

    您没有在需要时将out 包括在参数调用中,并且temp1 不是nullable boolean (bool?)。

    public static string ChangeDeviceState(int deviceID, DeviceState nextState)
    {
        bool? temp1;
        string temp;
        return ChangeDeviceState(deviceID, nextState, out temp1, out temp, "", "", "", "", ""); 
    }
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2019-01-08
      • 2015-02-26
      • 2022-01-15
      • 2020-10-14
      相关资源
      最近更新 更多