jeudi 19 août 2021

If I have multiple if else statement like this how do you consider refactor it?

If I have multiple if else statement like this how do you consider refactor it?

var a = DoSomethingToGetA();

if (UserPreviouslySignedIn)
{
    var b = DoSomethingToGetB();
  
    if (a == b && !string.IsNullOrWhiteSpace(a))
    {
        Validate(a);
    }
    else
    {
        Validate(b);
    }
}
else
{
    Validate(a);
}

Aucun commentaire:

Enregistrer un commentaire