I trying to get some values from database by using entity framework
i have a doubt about
Difference between
new ClassName
andnew ClassName()
in entity framewrok query
Code 1
dbContext.StatusTypes.Select(s => new StatusTypeModel() { StatusTypeId =
s.StatusTypeId, StatusTypeName = s.StatusTypeName }).ToList();
Code 2
dbContext.StatusTypes.Select(s => new StatusTypeModel { StatusTypeId =
s.StatusTypeId, StatusTypeName = s.StatusTypeName }).ToList();
You can see the changes from where i create a new StatusTypeModel
and new StatusTypeModel()
object.
- The both queries are working for me. but i don't know the differences between of code 1 and code 2 .