I am new to LINQ queries and want to use FirstOrDefault
in my existing LINQ query.
List<vUserAll> employee = (from o in db.vUsersAll
where (o.sAMAccountName == modifiedAccountName || o.CN == modifiedAccountName) && o.Domain == "dExample"
select o).ToList();
What’s the correct way to do this?
3
Answers
If the above mentioned is the case, then you can use a labmda as in the following:
If you want to use the same above expression then,
It’s a lot easier if you only use LINQ extensions. For example,
This can be simplified further as: