vendredi 31 juillet 2015

C# Multiple strings in a if-statment

I'm trying to check if a user input matches a few already known values. How do I do this in C#?

I've tried this:

if (UserInput.Text == "2", "4", "8", "16", "32")

      { do things 

      }
      else
      {
        do other things
      }

And a couple of other signs between my strings. Is it possible to check against all my strings or do I have to set up a seperate if-statment for all my strings?

Aucun commentaire:

Enregistrer un commentaire