Suppose for example you had this:
string[] city1 = { "Vancouver", "Richmond", "Delta", "Abbotsford", "Kelowna"};
string[] city2 = { "Vancouver", "Richmond", "Delta", "Surrey", "Burnaby", "Coquitlam", "Mission" };
listBox1.Items.AddRange(city1);
listBox2.Items.AddRange(city2);
then "Surrey", "Burnaby", "Coquitlam" and "Mission" would appear in the difference but "Abbotsford" and "Kelowna" would not.
You can deal with this problem by adding an additional foreach loop to Shrikant's code as follows:
foreach (var objLI in listBox1.Items)
{
if (!listBox2.Items.Contains(objLI))
listBox4.Items.Add(objLI); // Different List
}
hope it helps..