By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
457,911 Members | 1,179 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 457,911 IT Pros & Developers. It's quick & easy.

cannot implicitly convert 'string' to 'bool' / cannot implicitly convert 'bool' to 's

P: 3
public bool[] searchGame(string gameName)

{

string[] searchGame = {"Tibia", "Combat Arms", "Need for Speed", "Moto GP", "Risk", "Red Alert", "Monopoly", "Scrabble"};


if ( searchGame[0] == "Tibia")

{

return true;

}

else

{

return null;

}
//kindly please help me out. i'm doing a search button when a string is input. this is under web service.
Dec 1 '08 #1
Share this Question
Share on Google+
4 Replies


Expert 100+
P: 750
PRR
well your return type
public string[] searchGame(string gameName)
should be bool as you are returning boolean type ..
public bool searchGame(string gameName).
i got to say,.. this is pretty basic...Do go through a good C#.NET book..
Dec 1 '08 #2

P: 3
yea i tried using bool but another error came out "cannot implicitly convert 'bool' to 'bool[]'. tried googling it but no result. i'm sorry for the basic error but i'm only a beginner
Dec 1 '08 #3

Expert 100+
P: 750
PRR
bool not bool[], you are returning true or false...
Dec 1 '08 #4

P: 52
public bool searchGame(string gameName)

{

string[] searchGame = {"Tibia", "Combat Arms", "Need for Speed", "Moto GP", "Risk", "Red Alert", "Monopoly", "Scrabble"};


if ( searchGame[0] == "Tibia")

{

return true;

}

else

{

return false;

}
Dec 1 '08 #5

Post your reply

Sign in to post your reply or Sign up for a free account.