Equality issues

I don't know if anyone has come across this, but I ran into an interesting issue today.  I had done this LINQ query in C#:
 
from c in store.Customers
where c.IsActive = true
select c;
 
What I was trying to accomplish is find all of the customers where the active flag equals true (straight equality check).  What happened is all the records came back; this was because I used one equal sign, instead of two, and it actually assigned the values in the record, without giving me a compile error.
 
Very interesting...

Published Friday, June 06, 2008 2:28 AM by bmains
Filed under:

Comments

No Comments

The leading UI suite for ASP.NET - Telerik radControls
Outstanding performance. Full ASP.NET AJAX support. Nearly codeless development.