I’m making a small tool. I just want to know if the switch in the code below is the quickest/best way to achieve this? In PHP, I’d reference the variable name dynamically like $Stop{int Stop} -> $BackColor = "Color"

public void Populate(Color Color, int Stop)
{
Colour.BackColor = Color; // Bottom left - PictureBox
Hex.Text = ARGBToHex(Color.ToArgb()); // Hex (#703919) - TextBox
Red.Text = Color.R.ToString(); // Red (153) - TextBox
Green.Text = Color.G.ToString(); // Green (180) - TextBox
Blue.Text = Color.B.ToString(); // Blue (209) - TextBox
Alpha.Text = "100"; // Alpha (100) - TextBox
StopText.Text = Stop.ToString(); // Read-only (1) - TextBox
switch(Convert.ToInt16(StopText.Text))
{
case 1: Stop1.BackColor = Color; break; // Small light blue rectangle - PictureBox
case 2: Stop2.BackColor = Color; break; // Small dark blue rectangle - PictureBox
}
}
You can do this: