i have this code for example:
string i = "100";
if(i[1]==0)
{
MessageBox.Show("ok");
}
and I thought I should get “ok” but it doesnt work. What is i[1] here?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Your comparison is using the wrong type. When you use an indexer with a string, the result is a
char. Your if statement is using anint. You need to change your code to: