LINQ_List_Any_Cast1.htm
 
Code : LINQ_List_Any_Cast1.txt
Enumerable Method: Distinct:
  • Adding data to an Array List
    List<ObjectFacotry> listempdb = of1.cEmp();
    ArrayList ar1 = new ArrayList();
    foreach (var v1 in listempdb)
    {
    ar1.Add(v1.ename + " " + v1.job + " \t" + v1.deptno);
    }
  • IEnumerable<string> query = ar1.Cast<string>().Distinct().Select(e1 => e1);

Note with out distinct, "Miller CLERK 10", displayed twice due to a redundant row in the data source