I have Dictionary<Position, List<GameObject>> and I want to create new dictionary Dictionary<Position, List<Person>> which collect positions which including at least one person in the List<GameObject>.
I tried:
Dictionary<Position, List<Person>> persons = positions.ToDictionary( i => i.Key, i => i.Value.Where(obj => obj is Person)) positions is the first dictionary.
but it doesn't really work because the position sometimes is null and its not really type of Person because you don't convert it. anyway, do you have any ideas?