Linq Projection Question

Posted by Micah on Stack Overflow See other posts from Stack Overflow or by Micah
Published on 2010-04-02T12:44:12Z Indexed on 2010/04/02 12:53 UTC
Read the original article Hit count: 451

Filed under:
|
|
|

I'm trying to do the following:

from c in db.GetAllContactsQuery()
select new
{
   ID= c.ID,
   LastName = c.LastName,
   FirstName = c.FirstName,
   Email = c.Email,
   City =c.City+" "+c.State
}

The issue i'm running into is that if c.City or c.State are null, the City property returns null. How can I put a function right beside that City= declaration?

© Stack Overflow or respective owner

Related posts about LINQ

Related posts about c#