I have a LINQ query where I want to return changed objects. If I were in a constant functional mood, I could do something like copy-construtor-like, for example:
from widget in widgets select new widget { legs = widget.legs + 1, arms = widget.arms }
Unfortunately, I am doing this on an NHibernate entity object being modified, and I need to modify the original object. I am looking for some syntax with a little anonymous method with side effects, for example:
from widget in widgets select { widget.legs += 1; return widget }
(with apologies for Scala syntax)
Now I can do this update outside of the LINQ query, but I would prefer to do it inline if possible. Is it possible to insert operations voidsuch as in LINQ?
Joe source
share