I\'m curious if any developers use string.IsNullOrEmpty() more often with a negative than with a positive
e.g.
if (!string.IsNullOrEmpty())
I had the same question before I realized all I had to do to flip the question was to put the Not operator in front of the conditional. I think it cleande up my code some.
// need to check if tBx_PTNum.Text is empty
/*
if (string.IsNullOrWhiteSpace(tBx_PTNum.Text))
{
// no pt number yet
}
else
{
ptNum = Convert.ToInt32(tBx_PTNum.Text);
}
*/
if(!string.IsNullOrEmpty(tBx_PTNum.Text))
{
ptNum = Convert.ToInt32(tBx_PTNum.Text);
}