jeudi 18 juin 2020

How can I refactor this class in C# [closed]

I have this class

public class PersonValidation {
    public bool validate(){
        return caseOne() && caseTow() && caseTree() && caseFour();  
    }
    private bool caseOne() { return true; }
    private bool caseTwo() { return true; }
    private bool caseTree() { return true; }
    private bool caseFour() { return true; }
}

In future there will be more functions that will be call in validate function and it will be huge, If you see validate funcion it is returning this:

return caseOne() && caseTow() && caseTree() && caseFour();  

I want something cleaner do you recommend some design patter for making it?

Aucun commentaire:

Enregistrer un commentaire