An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
I use lambda expression code all of the time. I prefer it over regular code writing. Using lambda expressions really exposes object oriented programming and the power of using OOP to the developer, which is just as reliable as code that doesn't use lambda.
https://www.codingame.com/playgrounds/213/using-c-linq---a-practical-overview/lambda-expressions#:~:text=A%20lambda%20expression%20is%20a,a%20delegate)%20as%20a%20parameter.
Many code evaluation tools like Resharper encourage the use of lambda expressions and will change non lambda code to lambda code where applicable.
There is nothing wrong in using lambda expressions.
public async Task<List<DtoAuthor>> GetAll()
{
var dtos = new List<DtoAuthor>();
var authors = await pc.Author.ToListAsync();
dtos.AddRange(authors.Select(**author => new DtoAuthor()**
{
AuthorId = author.AuthorId,
FirstName = author.FirstName,
LastName = author.LastName
}).ToList());
return dtos;
}
Because I was able to use lambda on an AddRange().Select(), I didn't have to use a foreach loop to poputae a dtoAuthor from Author and load the dto into dtos list. The AddRange() did it all due to the lambda expression being used.