I realise .NET has all these great objects, specifically strings, but is it
really necessary to create a string variable (object) just to compare two
string values?
For example, I'm looking at an attribute of an XML string, and I wish to
compare it's value to a literal string, but it has to be a case in-sensitive
comparison. Do I really need to put these two values into a variable in
order to use the ToUpper() or ToLower() methods of the String object?
Heres' what I have:
if(oNode.Attributes.GetNamedItem("level").Value == "package")
{
}
or do I have to do this:
string sNodeValue = oNode.Attributes.GetNamedItem("level").Value;
string sLiteral = "package";
if( sNodeValue.ToLower() == sLiteral.ToLower() )
{
}