Master technical and career interviews with structured answers—short definition, real examples, pitfalls, and how to answer in 60–90 seconds.
Short answer: var salaryGroups = employees .Select(g => new { Range = g.Key, Count = g.Count() }); Example code var salaryGroups = employees .Select(g => new { Range = g.Key, Count = g.Count() }); Real-world exampl…
Short answer: Group employees by salary range (Low/High) var salaryGroups = employees .GroupBy(e => e.Salary > 75000 ? Explain a bit more "High" : "Low") .Select(g => new { Range = g.Key, Cou…
Short answer: Get last employee alphabetically by name var lastName = employees .OrderBy(e => e.Name) .LastOrDefault(); Get last employee alphabetically by name var lastName = employees .OrderBy(e => e.Name) .LastO…
Short answer: var avg = employees.Average(e => e.Salary); var avg = employees.Average(e => e.Salary); var avg = employees.Average(e => e.Salary); var avg = employees.Average(e => e.Salary); var avg = employee…
Short answer: Count distinct departments var deptCount = employees .Select(e => e.Department) .Distinct() .Count(); Count distinct departments var deptCount = employees .Select(e => e.Department) .Distinct() .Count…
Short answer: Find employee with lowest salary var lowest = employees .OrderBy(e => e.Salary) .FirstOrDefault(); Find employee with lowest salary var lowest = employees .OrderBy(e => e.Salary) .FirstOrDefault(); Fi…
Short answer: var items = new List<string> { "apple", "Apple", "banana", "apple" var distinct = items Example code var items = new List<string> { "apple", &qu…
Short answer: Remove duplicates from a list of strings var items = new List<string> { "apple", "Apple", "banana", "apple" var distinct = items .Distinct(StringComparer.Ordina…
Short answer: var groupedByFirstLetter = employees .Select(g => new { Letter = g.Key, Employees = g.ToList() }); Example code var groupedByFirstLetter = employees .Select(g => new { Letter = g.Key, Employees = g.To…
Short answer: var result = string.Join(", ", employees.Select(e => e.Name)); var result = string.Join(", ", employees.Select(e => e.Name)); var result = string.Join(", ", employees.Sel…
Short answer: var filtered = employees StringComparison.OrdinalIgnoreCase) >= 0); var filtered = employees StringComparison.OrdinalIgnoreCase) >= 0); var filtered = employees StringComparison.OrdinalIgnoreCase) >…
Short answer: Filter employees whose name contains 'a' (case-insensitive) var filtered = employees .Where(e => e.Name.IndexOf('a', StringComparison.OrdinalIgnoreCase) >= 0); Filter employees whose name contains 'a'…
Short answer: var result = from e in employees select new { e.Name, DeptLocation = d.Location }; Example code var result = from e in employees select new { e.Name, DeptLocation = d.Location }; Real-world example (ShopNes…
Short answer: Join two lists with different types var result = from e in employees join d in departments on e.Department equals d.Name select new { e.Name, DeptLocation = d.Location }; Join two lists with different types…
Short answer: Find the department with the most employees var mostPopulated = employees .GroupBy(e => e.Department) .OrderByDescending(g => g.Count()) .FirstOrDefault(); Find the department with the most employees…
Short answer: var evenNames = employees .Select(e => e.Name); var evenNames = employees .Select(e => e.Name); var evenNames = employees .Select(e => e.Name); var evenNames = employees .Select(e => e.Name); va…
Short answer: Find names of employees with even-length names var evenNames = employees .Where(e => e.Name.Length % 2 == 0) .Select(e => e.Name); Find names of employees with even-length names var evenNames = employ…
Short answer: var customSort = employees .ThenBy(e => e.Name); var customSort = employees .ThenBy(e => e.Name); var customSort = employees .ThenBy(e => e.Name); var customSort = employees .ThenBy(e => e.Name)…
Short answer: Custom sort by name length, then alphabetically var customSort = employees .OrderBy(e => e.Name.Length) .ThenBy(e => e.Name); Follow : Custom sort by name length, then alphabetically var customSort =…
Short answer: bool allAbove50k = employees.All(e => e.Salary > 50000); bool allAbove50k = employees.All(e => e.Salary > 50000); bool allAbove50k = employees.All(e => e.Salary > 50000); bool allAbove50k…
Short answer: bool exact = employees.Any(e => e.Salary == 75000); bool exact = employees.Any(e => e.Salary == 75000); bool exact = employees.Any(e => e.Salary == 75000); bool exact = employees.Any(e => e.Sala…
Short answer: var lookup = employees.ToLookup(e => e.Department); var lookup = employees.ToLookup(e => e.Department); var lookup = employees.ToLookup(e => e.Department); var lookup = employees.ToLookup(e => e…
Short answer: var deptNames = departments .Select(d => d.Name); var deptNames = departments .Select(d => d.Name); var deptNames = departments .Select(d => d.Name); var deptNames = departments .Select(d => d.N…
Short answer: Select department names that start with ‘F’ var deptNames = departments .Where(d => d.Name.StartsWith("F")) .Select(d => d.Name); Select department names that start with ‘F’ var deptNames =…
Short answer: var combined = employees.Select(e => $"{e.Name} - {e.Department}"); var combined = employees.Select(e => $"{e.Name} - {e.Department}"); var combined = employees.Select(e => $&qu…
LINQ LINQ Tutorial · LINQ
Short answer: var salaryGroups = employees .Select(g => new { Range = g.Key, Count = g.Count() });
var salaryGroups = employees
.Select(g => new { Range = g.Key, Count = g.Count() });
A sales report joins orders and customers, then GroupBy(c => c.City) to show revenue per city.
LINQ LINQ Tutorial · LINQ
Short answer: Group employees by salary range (Low/High) var salaryGroups = employees .GroupBy(e => e.Salary > 75000 ?
"High" : "Low") .Select(g => new { Range = g.Key, Count = g.Count() }); Follow : Group employees by salary range (Low/High) var salaryGroups = employees .GroupBy(e => e.Salary > 75000 ? "High" : "Low") .Select(g => new { Range = g.Key, Count = g.Count() }); Follow : Group employees by salary range (Low/High) var salaryGroups = employees .GroupBy(e => e.Salary > 75000 ? "High" : "Low") .Select(g => new { Range = g.Key, Count = g.Count() }); Follow : Group employees by salary range (Low/High) var salaryGroups = employees .GroupBy(e => e.Salary > 75000 ? "High" : "Low") .Select(g => new { Range = g.Key, Count = g.Count() }); Follow :
A sales report joins orders and customers, then GroupBy(c => c.City) to show revenue per city.
LINQ LINQ Tutorial · LINQ
Short answer: Get last employee alphabetically by name var lastName = employees .OrderBy(e => e.Name) .LastOrDefault(); Get last employee alphabetically by name var lastName = employees .OrderBy(e => e.Name) .LastOrDefault(); Get last employee alphabetically by name var lastName = employees .OrderBy(e => e.Name) .LastOrDefault(); Get last employee alphabetically by name… var lastName = employees .OrderBy(e => e.Name)…
ShopNest uses LINQ to query orders: filter by date, project to a summary DTO, and order by total—readable C# that becomes SQL under EF Core.
LINQ LINQ Tutorial · LINQ
Short answer: var avg = employees.Average(e => e.Salary); var avg = employees.Average(e => e.Salary); var avg = employees.Average(e => e.Salary); var avg = employees.Average(e => e.Salary); var avg = employees.Average(e => e.Salary); var avg = employees.Average(e => e.Salary); var avg = employees.Average(e => e.Salary); var avg = employees.Average(e => e.Salary);
var avg = employees.Average(e => e.Salary); var avg = employees.Average(e => e.Salary); var avg = employees.Average(e => e.Salary); var avg = employees.Average(e => e.Salary); var avg = employees.Average(e => e.Salary); var avg = employees.Average(e => e.Salary); var avg = employees.Average(e => e.Salary); var avg = employees.Average(e => e.Salary);
ShopNest uses LINQ to query orders: filter by date, project to a summary DTO, and order by total—readable C# that becomes SQL under EF Core.
LINQ LINQ Tutorial · LINQ
Short answer: Count distinct departments var deptCount = employees .Select(e => e.Department) .Distinct() .Count(); Count distinct departments var deptCount = employees .Select(e => e.Department) .Distinct() .Count(); Count distinct departments var deptCount = employees .Select(e => e.Department) .Distinct() .Count(); Count distinct departments var deptCount = employees . Select(e => e.Department) .Distinct() .Count();
ShopNest uses LINQ to query orders: filter by date, project to a summary DTO, and order by total—readable C# that becomes SQL under EF Core.
LINQ LINQ Tutorial · LINQ
Short answer: Find employee with lowest salary var lowest = employees .OrderBy(e => e.Salary) .FirstOrDefault(); Find employee with lowest salary var lowest = employees .OrderBy(e => e.Salary) .FirstOrDefault(); Find employee with lowest salary var lowest = employees .OrderBy(e => e.Salary) .FirstOrDefault(); Find employee with lowest salary var lowest = employees… OrderBy(e => e.Salary) .FirstOrDefault();
ShopNest uses LINQ to query orders: filter by date, project to a summary DTO, and order by total—readable C# that becomes SQL under EF Core.
LINQ LINQ Tutorial · LINQ
Short answer: var items = new List<string> { "apple", "Apple", "banana", "apple" var distinct = items
var items = new List<string> { "apple", "Apple", "banana", "apple"
var distinct = items
ShopNest uses LINQ to query orders: filter by date, project to a summary DTO, and order by total—readable C# that becomes SQL under EF Core.
LINQ LINQ Tutorial · LINQ
Short answer: Remove duplicates from a list of strings var items = new List<string> { "apple", "Apple", "banana", "apple" var distinct = items .Distinct(StringComparer.OrdinalIgnoreCase); Remove duplicates from a list of strings var items = new List<string> { "apple", "Apple", "banana", "apple" var distinct = items… Distinct(StringComparer.OrdinalIgnoreCase); Remove… duplicates from a list of strings var items = new List<string>…
{ "apple", "Apple", "banana", "apple" var distinct = items .Distinct(StringComparer.OrdinalIgnoreCase); Remove duplicates from a list of strings var items = new List<string> { "apple", "Apple", "banana", "apple" var distinct = items… Distinct(StringComparer.OrdinalIgnoreCase);
ShopNest uses LINQ to query orders: filter by date, project to a summary DTO, and order by total—readable C# that becomes SQL under EF Core.
LINQ LINQ Tutorial · LINQ
Short answer: var groupedByFirstLetter = employees .Select(g => new { Letter = g.Key, Employees = g.ToList() });
var groupedByFirstLetter = employees
.Select(g => new { Letter = g.Key, Employees = g.ToList() });
A sales report joins orders and customers, then GroupBy(c => c.City) to show revenue per city.
LINQ LINQ Tutorial · LINQ
Short answer: var result = string.Join(", ", employees.Select(e => e.Name)); var result = string.Join(", ", employees.Select(e => e.Name)); var result = string.Join(", ", employees.Select(e => e.Name)); var result = string.Join(", ", employees.Select(e => e.Name)); var result = string.Join(", ", employees.Select(e => e.Name)); var result = string.Join(", ", employees.Select(e => e.Name)); var result = string.Join(", ",…
employees.Select(e => e.Name)); var result = string.Join(", ", employees.Select(e => e.Name));
var result = string.Join(", ", employees.Select(e => e.Name)); var result = string.Join(", ", employees.Select(e => e.Name)); var result = string.Join(", ", employees.Select(e => e.Name)); var result = string.Join(", ", employees.Select(e => e.Name)); var result = string.Join(", ", employees.Select(e => e.Name)); var result = string.Join(", ", employees.Select(e => e.Name)); var result = string.Join(", ", employees.Select(e => e.Name)); var result = string.Join(", ", employees.Select(e => e.Name));
ShopNest uses LINQ to query orders: filter by date, project to a summary DTO, and order by total—readable C# that becomes SQL under EF Core.
LINQ LINQ Tutorial · LINQ
Short answer: var filtered = employees StringComparison.OrdinalIgnoreCase) >= 0); var filtered = employees StringComparison.OrdinalIgnoreCase) >= 0); var filtered = employees StringComparison.OrdinalIgnoreCase) >= 0); var filtered = employees StringComparison.OrdinalIgnoreCase) >= 0); var filtered = employees StringComparison.OrdinalIgnoreCase) >= 0); var filtered = employees StringComparison.OrdinalIgnoreCase) >= 0); var…
filtered = employees StringComparison.OrdinalIgnoreCase) >= 0); var filtered = employees StringComparison.OrdinalIgnoreCase) >= 0);
var filtered = employees StringComparison.OrdinalIgnoreCase) >= 0); var filtered = employees StringComparison.OrdinalIgnoreCase) >= 0); var filtered = employees StringComparison.OrdinalIgnoreCase) >= 0); var filtered = employees StringComparison.OrdinalIgnoreCase) >= 0); var filtered = employees StringComparison.OrdinalIgnoreCase) >= 0); var filtered = employees StringComparison.OrdinalIgnoreCase) >= 0); var filtered = employees StringComparison.OrdinalIgnoreCase) >= 0); var filtered = employees StringComparison.OrdinalIgnoreCase) >= 0);
ShopNest filters active products with products.Where(p => p.IsActive && p.Stock > 0) before showing the catalog.
LINQ LINQ Tutorial · LINQ
Short answer: Filter employees whose name contains 'a' (case-insensitive) var filtered = employees .Where(e => e.Name.IndexOf('a', StringComparison.OrdinalIgnoreCase) >= 0); Filter employees whose name contains 'a' (case-insensitive) var filtered = employees .Where(e => e.Name.IndexOf('a', StringComparison.OrdinalIgnoreCase) >= 0); Real-world… example (ShopNest)… ShopNest… filters active products with products.Where(p =>…
p.IsActive && p.Stock > 0) before showing the catalog. Filter employees whose name contains 'a' (case-insensitive) var filtered = employees .Where(e => e.Name.IndexOf('a', StringComparison.OrdinalIgnoreCase) >= 0); Filter employees whose name contains 'a' (case-insensitive) var filtered = employees .Where(e => e.Name.IndexOf('a', StringComparison.OrdinalIgnoreCase) >= 0); Real-world… example (ShopNest) ShopNest filters active products with products.Where(p => p.IsActive && p.Stock > 0) before showing the catalog.
LINQ LINQ Tutorial · LINQ
Short answer: var result = from e in employees select new { e.Name, DeptLocation = d.Location };
var result = from e in employees
select new { e.Name, DeptLocation = d.Location };
A sales report joins orders and customers, then GroupBy(c => c.City) to show revenue per city.
LINQ LINQ Tutorial · LINQ
Short answer: Join two lists with different types var result = from e in employees join d in departments on e.Department equals d.Name select new { e.Name, DeptLocation = d.Location }; Join two lists with different types var result = from e in employees join d in departments on e.Department equals d.Name select new { e.Name, DeptLocation =… d.Location }; Join two lists… with different types var result = from e in employees join d…
in departments on e.Department equals d.Name select new { e.Name, DeptLocation = d.Location }; Join two lists with different types var result = from e in employees join d in departments on e.Department equals d.Name select new { e.Name, DeptLocation =… d.Location }; Join two lists with different types var result = from e in employees join d in departments on e.Department equals d.Name select new { e.Name, DeptLocation = d.Location }; Join two lists with different types var result = from e in employees join d in departments on e.Department equals d.Name select new { e.Name, DeptLocation =… d.Location }; Join two lists with different types var result = from e in employees join d in departments on e.Department equals d.Name select new { e.Name, DeptLocation = d.Location }; Join two lists with different types var result = from e in employees join d in departments on e.Department equals…
Join two lists with different types var result = from e in employees join d in departments on e.Department equals d.Name select new { e.Name, DeptLocation = d.Location }; Join two lists with different types var result = from e in employees join d in departments on e.Department equals d.Name select new { e.Name, DeptLocation =… d.Location }; Join two lists… with different types var result = from e in employees join d in departments on e.Department equals d.Name select new { e.Name, DeptLocation = d.Location }; Join two lists with different types var result = from e in employees join d in departments on e.Department equals d.Name select new { e.Name, DeptLocation =… d.Location }; Join two lists with different types var result = from e in employees join d in departments on e.Department equals d.Name select new { e.Name, DeptLocation = d.Location }; Join two lists with different types var result = from e in employees join d in departments on e.Department equals d.Name select new { e.Name, DeptLocation =… d.Location }; Join two lists with different types var result = from e in employees join d in departments on e.Department equals d.Name select new { e.Name, DeptLocation = d.Location }; Join two lists with different types var result = from e in employees join d in departments on e.Department equals d.Name select new { e.Name, DeptLocation =… d.Location };
A sales report joins orders and customers, then GroupBy(c => c.City) to show revenue per city.
LINQ LINQ Tutorial · LINQ
Short answer: Find the department with the most employees var mostPopulated = employees .GroupBy(e => e.Department) .OrderByDescending(g => g.Count()) .FirstOrDefault(); Find the department with the most employees var mostPopulated = employees .GroupBy(e => e.Department) .OrderByDescending(g => g.Count()) .FirstOrDefault(); Real-world example… (ShopNest) ShopNest uses…… LINQ to query orders: filter by date, project to a summary…
DTO, and order by total—readable C# that becomes SQL under EF Core. Find the department with the most employees var mostPopulated = employees .GroupBy(e => e.Department) .OrderByDescending(g => g.Count()) .FirstOrDefault(); Find the department with the most employees var mostPopulated = employees .GroupBy(e => e.Department) .OrderByDescending(g => g.Count()) .FirstOrDefault(); Real-world example… (ShopNest) ShopNest uses LINQ to query orders: filter by date, project to a summary DTO, and order by total—readable C# that becomes SQL under EF Core.
LINQ LINQ Tutorial · LINQ
Short answer: var evenNames = employees .Select(e => e.Name); var evenNames = employees .Select(e => e.Name); var evenNames = employees .Select(e => e.Name); var evenNames = employees .Select(e => e.Name); var evenNames = employees .Select(e => e.Name); var evenNames = employees .Select(e => e.Name); var evenNames = employees .Select(e => e.Name); var evenNames = employees .Select(e => e.Name);
var evenNames = employees .Select(e => e.Name); var evenNames = employees .Select(e => e.Name); var evenNames = employees .Select(e => e.Name); var evenNames = employees .Select(e => e.Name); var evenNames = employees .Select(e => e.Name); var evenNames = employees .Select(e => e.Name); var evenNames = employees .Select(e => e.Name); var evenNames = employees .Select(e => e.Name);
ShopNest filters active products with products.Where(p => p.IsActive && p.Stock > 0) before showing the catalog.
LINQ LINQ Tutorial · LINQ
Short answer: Find names of employees with even-length names var evenNames = employees .Where(e => e.Name.Length % 2 == 0) .Select(e => e.Name); Find names of employees with even-length names var evenNames = employees .Where(e => e.Name.Length % 2 == 0) .Select(e => e.Name); Find names of employees with even-length names var evenNames = employees .Where(e =>… e.Name.Length % 2 == 0) .Select(e => e.Name); Find names of employees…
with even-length names var evenNames = employees .Where(e => e.Name.Length % 2 == 0) .Select(e => e.Name);
ShopNest uses LINQ to query orders: filter by date, project to a summary DTO, and order by total—readable C# that becomes SQL under EF Core.
LINQ LINQ Tutorial · LINQ
Short answer: var customSort = employees .ThenBy(e => e.Name); var customSort = employees .ThenBy(e => e.Name); var customSort = employees .ThenBy(e => e.Name); var customSort = employees .ThenBy(e => e.Name); var customSort = employees .ThenBy(e => e.Name); var customSort = employees .ThenBy(e => e.Name); var customSort = employees .ThenBy(e => e.Name); var customSort = employees .ThenBy(e => e.Name);
var customSort = employees .ThenBy(e => e.Name); var customSort = employees .ThenBy(e => e.Name); var customSort = employees .ThenBy(e => e.Name); var customSort = employees .ThenBy(e => e.Name); var customSort = employees .ThenBy(e => e.Name); var customSort = employees .ThenBy(e => e.Name); var customSort = employees .ThenBy(e => e.Name); var customSort = employees .ThenBy(e => e.Name);
ShopNest uses LINQ to query orders: filter by date, project to a summary DTO, and order by total—readable C# that becomes SQL under EF Core.
LINQ LINQ Tutorial · LINQ
Short answer: Custom sort by name length, then alphabetically var customSort = employees .OrderBy(e => e.Name.Length) .ThenBy(e => e.Name); Follow : Custom sort by name length, then alphabetically var customSort = employees .OrderBy(e => e.Name.Length) .ThenBy(e => e.Name); Follow : Custom sort by name length, then alphabetically var customSort = employees .OrderBy(e =>… e.Name.Length) .ThenBy(e => e.Name); Follow : Custom sort…
by name length, then alphabetically var customSort = employees .OrderBy(e => e.Name.Length) .ThenBy(e => e.Name); Follow :
ShopNest uses LINQ to query orders: filter by date, project to a summary DTO, and order by total—readable C# that becomes SQL under EF Core.
LINQ LINQ Tutorial · LINQ
Short answer: bool allAbove50k = employees.All(e => e.Salary > 50000); bool allAbove50k = employees.All(e => e.Salary > 50000); bool allAbove50k = employees.All(e => e.Salary > 50000); bool allAbove50k = employees.All(e => e.Salary > 50000); bool allAbove50k = employees.All(e => e.Salary > 50000); bool allAbove50k = employees.All(e => e.Salary > 50000); bool allAbove50k = employees.All(e => e.Salary > 50000); bool allAbove50k =…
bool allAbove50k = employees.All(e => e.Salary > 50000); bool allAbove50k = employees.All(e => e.Salary > 50000); bool allAbove50k = employees.All(e => e.Salary > 50000); bool allAbove50k = employees.All(e => e.Salary > 50000); bool allAbove50k = employees.All(e => e.Salary > 50000); bool allAbove50k = employees.All(e => e.Salary > 50000); bool allAbove50k = employees.All(e => e.Salary > 50000); bool allAbove50k = employees.All(e => e.Salary > 50000);
ShopNest uses LINQ to query orders: filter by date, project to a summary DTO, and order by total—readable C# that becomes SQL under EF Core.
LINQ LINQ Tutorial · LINQ
Short answer: bool exact = employees.Any(e => e.Salary == 75000); bool exact = employees.Any(e => e.Salary == 75000); bool exact = employees.Any(e => e.Salary == 75000); bool exact = employees.Any(e => e.Salary == 75000); bool exact = employees.Any(e => e.Salary == 75000); bool exact = employees.Any(e => e.Salary == 75000); bool exact = employees.Any(e => e.Salary == 75000); bool exact = employees.Any(e => e.Salary == 75000);
bool exact = employees.Any(e => e.Salary == 75000); bool exact = employees.Any(e => e.Salary == 75000); bool exact = employees.Any(e => e.Salary == 75000); bool exact = employees.Any(e => e.Salary == 75000); bool exact = employees.Any(e => e.Salary == 75000); bool exact = employees.Any(e => e.Salary == 75000); bool exact = employees.Any(e => e.Salary == 75000); bool exact = employees.Any(e => e.Salary == 75000);
ShopNest uses LINQ to query orders: filter by date, project to a summary DTO, and order by total—readable C# that becomes SQL under EF Core.
LINQ LINQ Tutorial · LINQ
Short answer: var lookup = employees.ToLookup(e => e.Department); var lookup = employees.ToLookup(e => e.Department); var lookup = employees.ToLookup(e => e.Department); var lookup = employees.ToLookup(e => e.Department); var lookup = employees.ToLookup(e => e.Department); var lookup = employees.ToLookup(e => e.Department); var lookup = employees.ToLookup(e => e.Department); var lookup = employees.ToLookup(e => e.Department);
var lookup = employees.ToLookup(e => e.Department); var lookup = employees.ToLookup(e => e.Department); var lookup = employees.ToLookup(e => e.Department); var lookup = employees.ToLookup(e => e.Department); var lookup = employees.ToLookup(e => e.Department); var lookup = employees.ToLookup(e => e.Department); var lookup = employees.ToLookup(e => e.Department); var lookup = employees.ToLookup(e => e.Department);
ShopNest uses LINQ to query orders: filter by date, project to a summary DTO, and order by total—readable C# that becomes SQL under EF Core.
LINQ LINQ Tutorial · LINQ
Short answer: var deptNames = departments .Select(d => d.Name); var deptNames = departments .Select(d => d.Name); var deptNames = departments .Select(d => d.Name); var deptNames = departments .Select(d => d.Name); var deptNames = departments .Select(d => d.Name); var deptNames = departments .Select(d => d.Name); var deptNames = departments .Select(d => d.Name); var deptNames = departments .Select(d => d.Name);
var deptNames = departments .Select(d => d.Name); var deptNames = departments .Select(d => d.Name); var deptNames = departments .Select(d => d.Name); var deptNames = departments .Select(d => d.Name); var deptNames = departments .Select(d => d.Name); var deptNames = departments .Select(d => d.Name); var deptNames = departments .Select(d => d.Name); var deptNames = departments .Select(d => d.Name);
ShopNest filters active products with products.Where(p => p.IsActive && p.Stock > 0) before showing the catalog.
LINQ LINQ Tutorial · LINQ
Short answer: Select department names that start with ‘F’ var deptNames = departments .Where(d => d.Name.StartsWith("F")) .Select(d => d.Name); Select department names that start with ‘F’ var deptNames = departments .Where(d => d.Name.StartsWith("F")) .Select(d => d.Name); Select department names that start with ‘F’ var deptNames = departments .Where(d =>… d.Name.StartsWith("F")) .Select(d => d.Name); Select department names that…
start with ‘F’ var deptNames = departments .Where(d => d.Name.StartsWith("F")) .Select(d => d.Name);
ShopNest maps entities to DTOs with .Select(o => new OrderSummaryDto { Id = o.Id, Total = o.Total }) so the API does not leak internal fields.
LINQ LINQ Tutorial · LINQ
Short answer: var combined = employees.Select(e => $"{e.Name} - {e.Department}"); var combined = employees.Select(e => $"{e.Name} - {e.Department}"); var combined = employees.Select(e => $"{e.Name} - {e.Department}"); var combined = employees.Select(e => $"{e.Name} - {e.Department}"); var combined = employees.Select(e => $"{e.Name} - {e.Department}"); var combined = employees.Select(e => $"{e.Name} - {e.Department}"); var…
combined = employees.Select(e => $"{e.Name} - {e.Department}"); var combined = employees.Select(e => $"{e.Name} - {e.Department}");
var combined = employees.Select(e => $"{e.Name} - {e.Department}"); var combined = employees.Select(e => $"{e.Name} - {e.Department}"); var combined = employees.Select(e => $"{e.Name} - {e.Department}"); var combined = employees.Select(e => $"{e.Name} - {e.Department}"); var combined = employees.Select(e => $"{e.Name} - {e.Department}"); var combined = employees.Select(e => $"{e.Name} - {e.Department}"); var combined = employees.Select(e => $"{e.Name} - {e.Department}"); var combined = employees.Select(e => $"{e.Name} - {e.Department}");
ShopNest uses LINQ to query orders: filter by date, project to a summary DTO, and order by total—readable C# that becomes SQL under EF Core.