nathanlime
New Member
I have one array \[code\]int[] com\[/code\] which contains two values 0 and 1 (at initial stage).I define one more array as \[code\]String[] arr = new String[100];\[/code\]\[code\]arr\[/code\] contains 6 elements which are:\[code\]arr[0]={4,8,10,11,12,14}arr[1]={1,2,3,4,8,12,14}.. arr[6]=something\[/code\]I want to find intersection of arr[0] and arr[1], so I wrote the code as:\[code\]int zero= Convert.ToInt32(com[0].ToString()); // zero gets 0, which is what i wantint one= Convert.ToInt32(com[1].ToString()); //one gets 1 which is what i wantvar intersect = (arr[zero]).Intersect(arr[one]); foreach (int value1 in intersect) { //perform logic}\[/code\]Here I should get value1 as 4,8 but i am getting value1 as 52,44.What is wrong with what I am doing?