Opposite of String.IsNullOrEmpty() or an alternative way

I wrote this script, that works:

if (String.IsNullOrEmpty(item.Description))
{
    tbItemInput.Rows.Add(tbRow2);
    tbItemInput.Rows.Add(tbRow3);
    tbItemInput.Rows.Add(tbRow4);
    tbItemInput.Rows.Add(tbRow5);
}
else if (item.Description.Equals("euro"))
{
    tbItemInput.Rows.Add(tbRow4);
    tbItemInput.Rows.Add(tbRow5);
    tbItemInput.Rows.Add(tbRow2);
    tbItemInput.Rows.Add(tbRow3);
}
else // I assume that this will always be "euro6" entry
{
    tbItemInput.Rows.Add(tbRow2);
    tbItemInput.Rows.Add(tbRow3);
    tbItemInput.Rows.Add(tbRow4);
    tbItemInput.Rows.Add(tbRow5);
}

but I really don't like it, but since I'm a php programmer, I have no idea how to write it correctly in ASP.NET

The idea is that, if the value item.Description is not present or is "euro6", it has one option, but, if the value is "euro", then the other one. In PHP I would do it like this

if ( $description == "euro" ) {
    // first option
} else {
    // second option
}

but in .NET if the value is not set I get an error, so I made a bad workaround.

Can I get some assistance to make this the right way?

Jon Skeet
people
quotationmark

"I get an error" is fairly vague - you would get a NullReferenceException if you used item.Description.Equals("euro")) but this should be fine:

if (item.Description == "euro")
{
    tbItemInput.Rows.Add(tbRow4);
    tbItemInput.Rows.Add(tbRow5);
    tbItemInput.Rows.Add(tbRow2);
    tbItemInput.Rows.Add(tbRow3);
}
else
{
    tbItemInput.Rows.Add(tbRow2);
    tbItemInput.Rows.Add(tbRow3);
    tbItemInput.Rows.Add(tbRow4);
    tbItemInput.Rows.Add(tbRow5);
}

people

See more on this question at Stackoverflow