I have 2 objects, both of which I want to convert to dictionarys. I use toDictionary<>().
The lambda expression for one object to get the key is (i => i.name). For th
something along the lines of
collection1.ForEach(i => myDictionary.Add((i.name.length == 0 ? i.inner.name : i.name),value);
(untested) should do the trick if i.name is not null (an empty string), or
collection1.ForEach(i => myDictionary.Add((i.name ?? i.inner.name),value);
(also untested)