Click here to Skip to main content
16,019,614 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have 2 array, array1 and array2. Array1 has 5 values from 1 to 5. Array 2 has values from 1 to 6. I need to get the extra value from array

Let me explain completely

Array1 - 1,2,3,4,5
Array2 - 1,2,3,4,5,6


I need to omit the same values and get 6 as my answer,
Can any1 help in this,
Posted

1 solution

Use Linq:
VB
Dim a1 As Integer() = New Integer() {1, 2, 3, 4, 5}
Dim a2 As Integer() = New Integer() {1, 2, 3, 4, 5, 6}
Dim diff As Integer() = a2.Except(a1).ToArray()
 
Share this answer
 
Comments
Usha Muhunthan 31-Oct-13 7:58am    
I am using framework 2.0, I need to do the task in 2.0 only

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