With Equals()
you can also use a Yoda condition:
if ( ! "-1".Equals(myString) )
Try this:
if(myString != "-1")
The opperand is !=
and not =!
You can also use Equals
if(!myString.Equals("-1"))
Note the !
before myString
Source: Stackoverflow.com