.net - C#: is there a way to set a property of objects in a collection using lambda expression? -


i developing small project , thought try don't know can learn new. have collection of messages, called msgs. filter unread ones , set "read". that, called method lambda expression, imagine list of messages unread. set value "read" (assigning 't' messageread property). there way using lambda expressions?

i got code, "all" method not loking for, found out checks if elements in list match condition.

msgs.where(message => message.messageread == 'f').all(message => message.messageread = 't'); 

thanks lot, oscar

what after foreach extension method, see discussions here: linq equivalent of foreach ienumerable<t>


Comments

Popular posts from this blog

c# - How to set Z index when using WPF DrawingContext? -

razor - Is this a bug in WebMatrix PageData? -

android - layout with fragment and framelayout replaced by another fragment and framelayout -