LINQ - Difference between two lists of different tables
Asked By remya on 22-Jun-12 03:53 AM
Hi,
I have two lists of different types.I want to compare them and to get the difference between them as a list.I am using Vb.net .
Plz help me
Jitendra Faye replied to remya on 22-Jun-12 04:54 AM
You can use equals method for this.
Use this code-
List<string> lst1 = new List<string>();
lst1.Add("1");
lst1.Add("12");
lst1.Add("11");
lst1.Add("3");
List<string> lst2 = new List<string>();
lst1.Add("11");
lst1.Add("2");
lst1.Add("1");
lst1.Add("3");
if(lst1.Equals(lst2))
{
//code
}
TRy this and let me know.