Home Forums C# Programming Cannot implicitly convert type int to string? why?

Viewing 1 reply thread
  • Author
    • #2114

      Hello i am still new to C#, has been a month now studying this from VS 2008 C# but now i am concentrating more on code than gui interface, i am looking right now if and else and switch, i decied to use a switch since it is new to me, it keeps giving me that error “implicitly convert type into string, for all 4 cases i made, why? all of the code is below:

    • #3405

      HelloYou are trying to use string type variable in your switch statement which is expecting an int type variable. Here is how you are doing

      Now the problem is you can not use string type variable in switch statement. You could use it like

      Or you could have use int type variable like

Viewing 1 reply thread
  • The forum ‘C# Programming’ is closed to new topics and replies.