Satya,
I'm not completely sure, but I think what you're asking for is a
distinct union of two collections right? If so then try the following
code which takes two collections and returns a new collection
containing the result of the union.
public ICollection Union(ICollection lhs, ICollection rhs)
{
Hashtable table = new Hashtable();
foreach (object element in lhs)
{
if (!table.Contains(element))
{
table.Add(element, element);
}
}
foreach (object element in rhs)
{
if (!table.Contains(element))
{
table.Add(element, element);
}
}
return result.Values;
}
Brian
Satya wrote:
Hi,
I am running with a specific problem ,I have 2 arraylists of object types.I
need to compare the 2 arraylists and I have to figure out the first
sequence of common objects in each array starting from index 0,then I have to
takeout the common objects and then all other object from the second array
list.
Thx
Satya