I need to check that a variable has one of a few different values. Currently I have code lik this:
if (cName == "Products" || cName == "Packages" || cName == "Contents" || cName == "Packages")
..
if (cName == "Products" || cName == "Packages" || cName == "Contents")
..
etc
It doesn’t look very clean to me. Is there some simpler one line way I could do this check? Some code where I would not have to keep repeating cName?
You could also have a look at Extension Methods.
Then you could use this ike: