Multi string array to multi dictionary in C#?

I got stuck to change the following array to a dictionary.

 public static string[][,] patterns = new string[][,]
 {
      new string[,] {
           { "1,2,3" },
           { "3,2,5" },
      },

      new string[,] {
           { "4,4,3" },
           { "7,1,2" },
      },
 
 };

This is what I have:

 public Dictionary<string, string[]> patterns = new Dictionary<string, string[]>();

I can't fill the array with predefined values.

I want to change to a dictionary, because it has a key.

Can I also change the above array to a key and values format?

I want something like this: { "keyNameExample1", "1,2,3", "4,5,6", "etc"}. I want do something like this: patterns["keyNameExample", 1 (integer array pack)]; or patterns["keyNameExample", 2]; (to get the second arrays)

{ "keyNameExample1", "1,2,3", "4,5,6", "etc"} { "keyNameExample2", "5,7,8", "1,1,1", "etc"} and get it like this: patterns["keyNameExample1", 2]; or patterns["keyNameExample2", 1];


Solution 1:

can make it even shorter like:

public static Dictionary<string, string[]> demo = new Dictionary<string, string[]>
            {
                { "abc", new[]{"1","2"}},
                { "def", new[]{"3","4"}},
            };

and with C# 9 you can even do:

public static Dictionary<string, string[]> demo = new()
            {
                { "abc", new[]{"1","2"}},
                { "def", new[]{"3","4"}},
            };