Hello Everybody:
Can any one tell me how to convert a Void Process to bool.. Pls guide...
if (ClientProcess()=true)
{
}
Thanks,
Rahil
Printable View
Hello Everybody:
Can any one tell me how to convert a Void Process to bool.. Pls guide...
if (ClientProcess()=true)
{
}
Thanks,
Rahil
First off... you need to use == instead of one =. :bigyello:
If its a void method then its not returning a value. Therefore you need to change the method:
e.g.
public void ClientProcess()
to
public bool ClientProcess()
you also need to add return statements throughout the method to ensure a result (of type bool) is returned.
HTH
DJ
Code:public bool ClientProcess()
{
if(whatever)
return true;
else
return false;
}
//......................
if(ClientProcess()) //assumes true
{
//??? code if true
}
else //if it was false...
{
//??? code if false
}