If you do something like you said, it will not go into the if block, and here is why:
Operators are applied to the object on the left. So your code is the same as writing this:
String myVar="in";
String testVar = myVar.ToUpper();
if(testVar=="in") //This will never be true
{
//do something
}
In your edit, you still aren't testing if your string is == "IN", you are doing 2 tests to see if your string is == "in".
If you changed your original to this it would work:
String myVar="in";
if(myVar.ToUpper()=="IN")
{
//do something
}
Your edit should be like this to test both cases:
if((myVar.ToUpper().Equals("IN"))&&(myVar.Equals("in")))
EDIT: Some more explanation from Steven's Comment:
if((myVar.ToUpper().Equals("IN"))&&(myVar.Equals("in")))
That code sample does 2 comparisons, but if myVar will only ever be mixed case versions of in (IE: in In iN IN) then the second comparison is not necessary. Once I have converted the string to ToUpper(), you only need to check if it is equal to IN. So I would replace that line with:
if(myVar.ToUpper().Equals("IN"))
or
if(myVar.ToUpper() == "IN")
I would personally use the == not the .Equals method.