bool connected = false;
if (isConnected()) //if(isConnected() == true) also doesn't work
{
//code
}
else {
connect();
}
public bool isConnected() {
if (nextEvent != "null" && !nextEvent.Contains(getEvent("disconnected"))) {
connected = true;
}
return connected;
}
得到错误:
无法将方法组“isConnected”转换为非委托类型“bool”。
为什么?我已经查过了,在大多数情况下,人们忘记在函数名后面加上括号,如下所示:
if(isConnected) { // .... }
对我来说不是这样。怎么了?