I have a color dictionary as shown below.
Dictionary<string, List<System.Drawing.Color>> channelColorInformation =
new Dictionary<string, List<System.Drawing.Color>>();
List<System.Drawing.Color> colorInfo = new List<System.Drawing.Color>();
System.Drawing.Color color = System.Drawing.ColorTranslator.FromHtml("#FFF0F8FF");
colorInfo.Add(color);
color = System.Drawing.ColorTranslator.FromHtml("#FFFAEBD7");
colorInfo.Add(color);
color = System.Drawing.ColorTranslator.FromHtml("#FF00FFFF");
colorInfo.Add(color);
channelColorInformation.Add("Channel1", colorInfo);
How do I get the System.Drawing.Color information from the dictionary for Channel1 at index 0, 1, 2?
Something like this:
UPDATE
@Jon’s answer is also relevant because it shows two options for dealing with the possibility that the key is not present in the dictionary.