Arrays in C#

Continue with the Color project and modify the code as shown below:

// Programmer: Janet Joy
// Working with arrays of objects
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace colors
{
    public partial class Form1 : Form
    {
        // Two arrays that are related to each other are called parallel arrays.
        // For this project make sure the sorted property of the combo box is false.
        string[] myColors = { "red", "yellow", "blue", "white" };
        Color[] colors = { Color.Red, Color.Yellow, Color.Blue, Color.White };
        public Form1()
        {
            InitializeComponent();
        }

        private void Form1_Load(object sender, EventArgs e)
        {
            for(int i=0;i<myColors.Length;i++)
            {
                cboColor.Items.Add(myColors[i]);
            }
            cboColor.SelectedIndex = 0;
        }

        private void cboColor_SelectedIndexChanged(object sender, EventArgs e)
        {
            int num = cboColor.SelectedIndex;
            this.BackColor = colors[num];
        }
    }
}

NEXT: Microsoft Reference: Collections