Array of dictionaries in C#

后端 未结 5 1783
挽巷
挽巷 2020-12-15 05:42

I would like to use something like this:

Dictionary[] matrix = new Dictionary[2];

But, when I do:

5条回答
  •  臣服心动
    2020-12-15 06:06

    Try this:

    Dictionary[] matrix = new Dictionary[] 
    {
        new Dictionary(),
        new Dictionary()
    };
    

    You need to instantiate the dictionaries inside the array before you can use them.

提交回复
热议问题