Click here to Skip to main content
12,698,688 members (29,347 online)
Rate this:
 
Please Sign up or sign in to vote.
See more: LINQ
IDictionary<int, IList<int>> secondlevel = new Dictionary<int, IList<int>>();
IDictionary<int, IList<int>> thirdlevel = new Dictionary<int, IList<int>>();
 secondlevel.Add(1, new List<int>(new int[] { 1, 2 }));
 secondlevel.Add(2, new List<int>(new int[] { 3 }));
 secondlevel.Add(3, new List<int>(new int[] { 4, 5, 6 }));

 thirdlevel.Add(1, new List<int>(new int[] { 5, 6, 7, 8, 20, 13, 24 }));
 thirdlevel.Add(2, new List<int>(new int[] { 23 }));
 thirdlevel.Add(3, new List<int>(new int[] { 22, 25, 26, 27 }));
 thirdlevel.Add(4, new List<int>(new int[] { 19, 28, 29, 30, 31, 38, 33 }));
 thirdlevel.Add(5, new List<int>(new int[] { 32, 35 }));
 thirdlevel.Add(6, new List<int>(new int[] { 34, 36, 37 }));


The secondlevel's value is thirdlevel's key,now I get a value which is one of thirdlevel's value,I want to get its embranchment index,How to write Linq?
Eg:5 index is 0, 23 index is 7, 22 index is 0 ,19 index is 0,32 index is 7
Posted 12-May-12 15:48pm
Updated 12-May-12 15:49pm
v3
Comments
Clifford Nelson 12-May-12 21:05pm
   
I think you need to be a bit more clear for most people. I attempt to lookup embranchment index, and find nothing. Saying that 5 index is 0 does not make any sense to me since I see 0 nowhere in the lists. At least I can see 23 and 7. I probably could help you but am lost ast to what you want to accomplish.
Shahin Khorshidnia 14-May-12 13:34pm
   
What do you mean The secondlevel's value is thirdlevel's key?
The values of secondlevel are List but keys are int.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month


Advertise | Privacy | Mobile
Web02 | 2.8.170118.1 | Last Updated 12 May 2012
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100