jeudi 21 septembre 2017

Possible To Convert To Inline If?

I have this code:

if (date.Equals(DateTime.MinValue))
{
    this.textBox.Text = string.Empty;
}
else
{
    if (!myList.Any())
    {
        this.textBox.Text = 
        CheckIfSaturdayOrSunday(date).ToShortDateString();
    }
    else
    {
        this.textBox.Text = CheckMyList(date, 
            myList).ToShortDateString();
    }
}

I was wondering if it was possible to consolidate that all into a nested inline if?

If not, I'll just keep it as is.

Thanks!

Aucun commentaire:

Enregistrer un commentaire