Data table dynamic code issue

Hi,

It’s LINQ expression. It mainly consists of 3 method : ToDictionary, Cast and Count.
In this case, it returns dictionary which are name as key and number of “P” as value.
ToDictionary method returns dictionary from IEnumerable<T> ( in this case it’s DataRow array).
Function(r) r(0).ToString returns content of name column of the row. it will be key of dictionary.
Function(r) dt.Columns.Cast(Of DataColumn).Count(Function(c) r(c).ToString="P") returns count of “P” in each column of the row.

The following topic might also help you.

Regards,

1 Like