TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
paddy
NA
10
0
How to join 2 dictionaries together ?
Oct 19 2008 1:23 PM
Hi,
how do I (aggregate ?) two dictionaries ?
I have the following code :
private Dictionary <int, aor.PhysicalObject> agents;
private Dictionary <int, aor.PhysicalObject> objects;
agents = (from a in log.InitialState.Agents.Agent
select a).ToDictionary(d => Convert.ToInt32(d.id), d => d as aor.PhysicalObject);
objects = (from o in log.InitialState.Objects.Object
select o).ToDictionary(d => Convert.ToInt32(d.id), d => d as aor.PhysicalObject);
what I want now, is ONE dictionary containing all elements of the agents & objects dictionary. You may
think that there could be a problem with duplicate keys, but each key (id) is unique, so there will be no
problem.
Would be very cool, if this task could be done via only one LINQ query (like the above... just "put together").
Many thanks in advance :-)
bye
paddy3k
Reply
Answers (
1
)
DLINQ Posts
Linq to XML - Projecting an Object hierarchy