0

I know the basic difference between an array and a Dictionary and I thought I was declaring this correctly, but I keep getting an exception that the "F1 index doesn't exist". What am I doing wrong?

        private Dictionary<string, Dictionary<string, string>> fixers = new Dictionary<string, Dictionary<string, string>>
        {
            ["F1"] = {
                ["PrefName"] = "KillF1UnhelpfulHelp",
                ["Img"] = @"/graphics/F1key.png",
                ["Title"] = @"Diable F1 ""Help"" function",
                ["Description"] = @"
                    Have you ever hit the F1 key by accident and had a distracting and unhelpful window or webpage open as a result? 
                    Windows set the F1 key to a generic help function that basically never helps and always gets in the way. 
                    Enable this control to disable that obnoxious design choice. Note that some programs still respond to F1 on their own accord, 
                    but this will stop the default Windows behavior in things like Windows Explorer at least.
                    ",
                ["Tags"] = "#Keyboard,#Rage"
            },
            ["CMD"] = {
                ["PrefName"] = "RestoreAdminCMDContext",
                ["Img"] = @"/graphics/CMD.png",
                ["Title"] = @"Restore ""Open Admin CMD Window Here"" to Windows Explorer",
                ["Description"] = @"
                    When you need to run commands in CMD, it's usually in a specific folder. Windows used to have an option when you CTRL+Right Click 
                    to show ""Open CMD HERE"" on a folder. This restores that function AND it's at administrative level (and you don't need to CTRL+CLICK to see it)
                    ",
                ["Tags"] = "#Windows Explorer,#TimeSaver"
            },
}
not_a_generic_user
  • 1,906
  • 2
  • 19
  • 34
  • 2
    You need `["F1"] = new Dictionary { ["PrefName"] =....` – Charlieface Sep 30 '21 at 13:35
  • Note that your title asks about "string-indexed arrays" - there's no such thing. You are creating dictionaries, not arrays. I suggest you edit the question to remove all mention of arrays. – Jon Skeet Sep 30 '21 at 13:38

0 Answers0