samedi 20 juin 2020

Is there any way that I can simplify the use of multiple "if's" inside one another

Here's an example of what I mean. The code works but I wonder if there's another way that I can implement the same functionality:

        if (App.ShowIcons)
        {
            if (App.devIsIOS)
            {
                this.Children.Add(FR1, 0, 0);
                this.Children.Add(GT, 1, 0);
                this.Children.Add(FR2, 2, 0);
            }
            else
            {
                this.Children.Add(FR1, 0, 0);
                this.Children.Add(GT, 1, 0);
                this.Children.Add(CE, 2, 0);
            }
        }
        else
        {
            if (App.devIsIOS)
            {
                this.Children.Add(GT, 0, 0);
                this.Children.Add(FR2, 1, 0);
            }
            else
            {
                this.Children.Add(GT, 0, 0);
                this.Children.Add(CE, 1, 0);
            }
        }

Aucun commentaire:

Enregistrer un commentaire