I am trying to extract the values shared by two arraylist into another arraylist.
using System.Linq;
private ArrayList GetSameOf2AL(ArrayList first, ArrayList second)
{
ArrayList same = new ArrayList();
var one = from int i in first select i;
var two = from int i in second select i;
var SameVal = one.Intersect(two);
//I am supposed to convert or cast SameVal into arraylist here
return same;
}
My questions are:
- I couldn’t convert the
vartype back intoarraylist, can someone advise me how? - Did I choose a wrong method to do this at the first place? Your advise is appreciated.
Thank you all for your kind attention =)
or