I have some code that performs a query.
int credenciadaId = 10;
var nome = from c in db.SanCredenciadas
where c.CredenciadaId == credenciadaId
select c.Name;
My question is in 2 parts.
I want the query to return just one Name as a string. How can I change the query nome so the following code would be valid?
string name = nome;
Additionally, how can I write the improved query so that it uses lambda expression(s) and the method syntax rather than the current query syntax?
like this
This will fail if you don’t get one result which I suspect is what you want.
Your query using a lambda would be