if-else equivalent via linq-to-sql query in where clause c#
Posted
by Darcy
on Stack Overflow
See other posts from Stack Overflow
or by Darcy
Published on 2010-05-21T21:03:35Z
Indexed on
2010/05/21
21:10 UTC
Read the original article
Hit count: 326
Hi guys,
Basically I wanted to have an if-else statement in my linq to sql statement.
var query = from d in database
if(x == y) {
where d.Attr = x
}
else {
where d.Attr = y
}
select d;
Any ideas?
© Stack Overflow or respective owner