By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
431,872 Members | 2,392 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 431,872 IT Pros & Developers. It's quick & easy.

Toggle

P: n/a
Hello,

I need to set the property IsActive = false for all records but one
which has FileID = id

database.Files.Select(p =p.FileID != id)

I am selecting the records ... I just don't know how to change the
IsActive of all this records to false.

If possible using lambda.

Thanks,
Miguel
Nov 18 '08 #1
Share this Question
Share on Google+
3 Replies


P: n/a
On Nov 18, 11:25*pm, shapper <mdmo...@gmail.comwrote:
Hello,

I need to set the property IsActive = false for all records but one
which has FileID = id

database.Files.Select(p =p.FileID != id)

I am selecting the records ... I just don't know how to change the
IsActive of all this records to false.

If possible using lambda.

Thanks,
Miguel
I also tried:
database.Files.Where(p =p.FileID != id).Select(p =p.IsActive =
false);

But I get an error:
An expression tree may not contain an assignment operator
Nov 18 '08 #2

P: n/a
On Tue, 18 Nov 2008 15:25:31 -0800, shapper <md*****@gmail.comwrote:
Hello,

I need to set the property IsActive = false for all records but one
which has FileID = id

database.Files.Select(p =p.FileID != id)

I am selecting the records ... I just don't know how to change the
IsActive of all this records to false.

If possible using lambda.
Not directly, no. For some reason, there's no "ForEach()" method in the
Enumerable class.

But, you can certainly just write a foreach() loop and do it explicitly.

Pete
Nov 18 '08 #3

P: n/a
On Nov 18, 11:45*pm, "Peter Duniho" <NpOeStPe...@nnowslpianmk.com>
wrote:
On Tue, 18 Nov 2008 15:25:31 -0800, shapper <mdmo...@gmail.comwrote:
Hello,
I need to set the property IsActive = false for all records but one
which has FileID = id
database.Files.Select(p =p.FileID != id)
I am selecting the records ... I just don't know how to change the
IsActive of all this records to false.
If possible using lambda.

Not directly, no. *For some reason, there's no "ForEach()" method in the *
Enumerable class.

But, you can certainly just write a foreach() loop and do it explicitly.

Pete
Thank You Pete,
Miguel
Nov 19 '08 #4

This discussion thread is closed

Replies have been disabled for this discussion.