Click here to Skip to main content
16,018,057 members
Articles / Programming Languages / C#

ForEach extension on IList

Rate me:
Please Sign up or sign in to vote.
4.67/5 (5 votes)
2 Oct 2011CPOL 10.8K  
Despite the existance of all that fancy lambda stuff, I would still write this the old-school way:var studentList = new List();foreach (var st in studentList) { if (st.Age == 0) st.AgeInMonths = DateTime.Now.Subtract(st.DOB).TotalDays / 30);} My "solution" needs ~160...

Views

Daily Counts

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Software Developer
Germany Germany
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions