C# 为什么这些参数不起作用?

C# 为什么这些参数不起作用?,c#,nullable,out,C#,Nullable,Out,我所要做的就是使用另一种方法,在这种方法中,其他参数是不必要的。I bool isAccessToken必须为空,challengeOrToken必须是out参数 我得到一个非法参数错误 我真的不理解c#中的这些参数特性。非常感谢您的帮助 当需要时,您不包括在参数调用中,temp1不是(bool?) public static string ChangeDeviceState(int deviceID, DeviceState nextState) { bool temp1; s

我所要做的就是使用另一种方法,在这种方法中,其他参数是不必要的。I bool isAccessToken必须为空,challengeOrToken必须是out参数

我得到一个非法参数错误

我真的不理解c#中的这些参数特性。非常感谢您的帮助

当需要时,您不包括在参数调用中,
temp1
不是(
bool?

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 )
{
public static string ChangeDeviceState(int deviceID, DeviceState nextState)
{
    bool? temp1;
    string temp;
    return ChangeDeviceState(deviceID, nextState, out temp1, out temp, "", "", "", "", ""); 
}