Click here to Skip to main content
15,894,646 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
C#
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
Updated 12-May-12 14: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)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900