So for this example lets say I have a DataTable which is called dt and it has some number of columns, I want to get back a list of the column names and how many different values are in each column. Also I would like the result set ordered by the largest to the smallest
For example I have a table with 4 columns and 40 rows of data, in the first column there is 4 distinct values, second column 12, third column 20, fourth column 40. I want my result set to look like this
Column4 40
Column3 20
Column2 12
Column1 4
How could I achieve this using C# and Linq?
Your LINQ code