c# - solved; Cannot convert method group... NOT missing parentheses -


bool connected = false;      if (isconnected())  //if(isconnected() == true) doesn't work         {           //code         }         else {            connect();         }  public bool isconnected() {     if (nextevent != "null" && !nextevent.contains(getevent("disconnected"))) {         connected = true;     }     return connected; } 

getting error:

cannot convert method group 'isconnected' tot non-delegate type 'bool'. 

why? i've looked , in cases, people forget put parentheses after function name, this:

if(isconnected) { // .... } 

which not case me. what's wrong? in advance.

you trying define function inside other function, if put function in out side function, suppose code calling inside yourfun() take isconnected() definition out side yourfun()

void yourfun() {     bool connected = false;          if (isconnected())  //if(isconnected() == true) doesn't work     {           //code     }     else {            connect();     } }  public bool isconnected() {     if (nextevent != "null" && !nextevent.contains(getevent("disconnected"))) {         connected = true;     }     return connected; } 

Comments

Popular posts from this blog

curl - PHP fsockopen help required -

HTTP/1.0 407 Proxy Authentication Required PHP -

c# - Resource not found error -