I want to remove an item from the result of a LINQ query before using it to databind. What is the proper way to do this?
The foreach in my illustration is the topic of my question. Illustration:
var obj =
(from a in dc.Activities
where a.Referrer != null
&& a.Referrer.Trim().Length > 12
&& a.Session.IP.NumProblems == 0
&& (a.Session.UID == null || a.Session.UID < 1 || a.Session.User.BanLevel < 1)
select a)
.Take(int.Parse(ConfigurationManager.AppSettings["RecentItemQty"]));
foreach (Activity act in obj)
if (isDomainBlacklisted(ref dc, act.Referrer))
obj.Remove(act);