Posts
33
Comments
135
Trackbacks
0
June 2013 Entries
LINQ example with GroupBy clause on a property in object
//group all above policies by broker to send an email about "broker re-assignment'
var brokerPolicies = from pol in policy.ListData.AsEnumerable()
                     group pol by pol.Field<int>("intUserID") into grp
                     select new
                     {
                             brokerID = grp.Key,
                             listOfPolicies =  from x in grp.AsEnumerable()
                                               select new 
                                               {
                                                      list = String.Format("{0:00}-{1:000000}",x.Field<short>("intPolicySequence"), x.Field<int>("intPolicyNumber"))
                                                }
                     };
Posted On Thursday, June 6, 2013 5:55 PM | Comments (3)