I've recently encountered an problem that has me wondering what two double quotes means to the compiler in C#.
string Var, blankVar;
Var = null; //Var is not instantiated or defined.
Var = ""; //Var should be blank or empty, but it is not null.
Var = "house"; //Var is defined as the string value house.
blankVar = ""; //blankVar should be blank or empty, but it is not null.
At this point the compiler should have the value of "house" stored into the string variable Var. The string variable blankVar should be empty.
if (Var.Contains(blankVar)) //if "house" contains "" then..
{
// do something
}
If Var is equal to "house" and does not contain empty (""), why is the compiler still stepping into the if statement?