String compare question …

What is the most efficient method for me to check the value of a string .. or more to the point .. not waste time during the checking ..

What I am trying to do is check for a value in a string .. and when i encounter that value, do nothing, but for all other values, do something…

Would it be something like :

if (stringVar.Equals("bob") { // Do nothing } else { // Do Stuff } 


if (!stringVar.Equals("bob") { //Do Stuff } 

or is there an even better way to achieve this?

by PST-Hater via /r/csharp

Leave a Reply