I have a Block[] Blocks
, and the class Block contains a string Name
.
I also have a Dictionary<string,int> Names
, in which the index of a block in the blocks array is stored with that block’s name as the key.
in a loop meant to populate the dictionary using the block array:
i get an error, saying that the field ‘key’ cannot be null
_
Here is a screenshot from Visual Studio: