I have created dictionary and inserted 3 fields to it:
Dictionary<string, Map> targets = new Dictionary<string, Map>();
targets.Add("Pláž - střed", new Map("Pláž - sever", "Vrak letadla", "Džungle", "Vrak letadla"));
targets.Add("Vrak letadla", new Map("Pláž střed", "nothing", "Roští", "nothing"));
targets.Add("Roští", new Map("nothing", "nothing", "Tenký lesík", "Vrak letadla"));
When I tried to get field targets[Pláž - sever], map constructor parameters contained "nothing", "nothing", "Tenký lesík", "Vrak letadla" – value of the last field, value is the same for 2nd and 3rd field. Can you please help me solve that problem?
I need 1st field to return its value, and not the value of the third field.
Your question is a little odd to start with – but I suspect you’ll find that your
Mapclass has static fields instead of instance fields. That would mean you’ve got one set of fields related to the type, and not to any particular instance of the type… so every time you overwrite the fields, you’re losing all your previous data.Just a guess though…