I have method that returns list of employee positions List<string> listPositions. If method returns only one string basic logic would be something like this:
if (listPositions.Contains("Admin"))
{
// business logic 1,for example Console.WriteLine("I'm Admin");
}
else if (listPositions.Contains("OfficeDirector"))
{
//business logic 2
}
else if (listPositions.Contains("Regular") || listPositions.Contains("HumanResource"))
{
//business logic 3
}
Now, method can return more than one string, so employee can be Admin and Office Director for example.Now I need to combine implementation in first if and first else if and I don't want to get lost inside several if-statements, so I'm asking you if there is more elegant solution to this problem . Thank you.
Aucun commentaire:
Enregistrer un commentaire