jeudi 27 mai 2021

c# asp.net mvc - simplification

how can I simplify this composite condition?

    @if (Model.State.Inventory[0] == true
     && Model.State.Inventory[1] == true
     && Model.State.Inventory[2] == true
     && Model.State.Inventory[3] == true
     && Model.State.Inventory[4] == true
     && Model.State.Inventory[5] == true)
    {
        <a type="button" class="btn btn-secondary" asp-page="Cellar">Go to the Cellar</a>
    }

Aucun commentaire:

Enregistrer un commentaire