Linq with alias

alias, c#, linq

Solution

You can use `let` to create intermediate values:

var name = (from x in db.authors
            let fullName = x.name + " " + x.surname
            where fullName == "Jean Paul Olvera"
            orderby x.surname
            select new { x.id_author, fullName });

Problem

I have the following line in c#: ``` var name = (from x in db.authors where fullName == "Jean Paul Olvera" orderby x.surname select new { x.id_author, fullName= String.Concat(x.name," ", x.surname) }); ``` my problem is I want to use the alias in my where clause, but I can't, 'fullName' appears as not declared.

Original source