If String.Empty
is as good as ""
, then how come the compiler throws up with string.Empty in the case
statement? Nothing can be more constant than string.Empty
in my view. Anyone know? Thanks!
switch (filter)
{
case string.Empty: // Compiler error "A constant value is expected"
break;
case "": // It's Okay.
break;
}