- Home /
Strange Behavior with Dictionary of List of generic Actions
Background: I found out about this while I'm implementing an event system, where classes subscribe to an specific event type, e.g. PlayerDied.
I've noticed that:
Dictionary<Type, List<Action<EventBase>>> test = new Dictionary<Type, List<Action<EventBase>>>();
test[typeof(EventBase)] = new List<Action<EventBase>>();
correctly sets the Key to the dictionary but with a null Value for the List. See image:
Does anyone know why this happens? Could this be a bug?
dictionaryaction.png
(31.7 kB)
Comment
Your answer
Follow this Question
Related Questions
Multiple Cars not working 1 Answer
Distribute terrain in zones 3 Answers
C#: Worlking with nested Dictionaries 2 Answers
Accessing a Class's Variables from within a Dictionary Element 1 Answer
Using LINQ in Unity 1 Answer