If I have the following test code:
In all three examples, "found" should be true, however, it never happens.Code:String content = "This is a test"; String str = "This"; String lookFor = content.Substring(0, 5); // "This" Boolean found = false; // "found" should equal true, BUT IT'S NOT!!! Why?? if (str == lookFor) found = true; // "found" should equal true, BUT IT'S NOT!!! Why?? if (str.Equals(lookFor)) found = true; // "found" should equal true, BUT IT'S NOT!!! Why?? switch (lookFor) { case "This": found = true; break; }
Where am I going wrong?
Thanks.



LinkBack URL
About LinkBacks



