Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Get the first item property with lambda expression

In C#, I'm going to use lambda expression, I have such a code

var item = dbContext.Products.ToList();

How can i get a property of Product table.

like image 493
Master Avatar asked Nov 23 '25 21:11

Master


1 Answers

try this

var item = dbContext.Products.FirstOrDefault().Name;
like image 179
Hayot Avatar answered Nov 26 '25 09:11

Hayot