Click here to Skip to main content
Rate this: bad
good
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 14:48pm
Edited 12-May-12 14:49pm
v3
Comments
Clifford Nelson at 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 at 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
0 OriginalGriff 300
1 Maciej Los 180
2 Richard MacCutchan 115
3 arvind mepani 104
4 Tino Fourie 92


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