Tuesday, November 29, 2011

Datatable/Dataset to List object unique column using Linq


private List<object> GetUniqueColumnValue(DataTable dsdatatable, string strColumnName)
        {
            List<object> x = (from r in dsdatatable.AsEnumerable()
                              select r[strColumnName]).Distinct().ToList();

            return x;
        }

No comments:

Post a Comment