Interview Q&A

Master technical and career interviews with structured answers—short definition, real examples, pitfalls, and how to answer in 60–90 seconds.

4608 total questions 4508 technical 100 career & HR 4272 from PDF library

Showing 51–75 of 219

Career & HR topics

By tech stack

Mid PDF
Why use AsEnumerable()?

Short answer: var query = dbContext.Employees .Where(e => CustomFunction(e.Name)); var query = dbContext.Employees .Where(e => CustomFunction(e.Name)); var query = dbContext.Employees .Where(e => CustomFunction(…

Mid PDF
Why use AsEnumerable()?

Short answer: Why use AsEnumerable()? var query = dbContext.Employees .AsEnumerable() // switch to in-memory .Where(e => CustomFunction(e.Name)); ✅ Use when your logic can't be translated to SQL. Why use AsEnumerable(…

Mid PDF
Detect and avoid N+1 query in EF?

Short answer: Detect and avoid N+1 query in EF? Use Include() to load related entities: var orders = dbContext.Orders .Include(o => o.Customer) .ToList(); Detect and avoid N+1 query in EF? Use Include() to load relate…

Mid PDF
How to force immediate execution?

Short answer: How to force immediate execution? Use .ToList(), .ToArray(), .Count(), .First() etc. Follow : Real-world example (ShopNest) ShopNest builds a LINQ query for search filters, then calls ToListAsync() once in…

Mid PDF
Can we use LINQ on JSON?

Short answer: Can we use LINQ on JSON? ✅ Yes — using System.Text.Json or Newtonsoft.Json, then LINQ on parsed objects. Real-world example (ShopNest) ShopNest uses LINQ to query orders: filter by date, project to a summar…

Mid PDF
How to create a dummy sequence of numbers from 1 to 10?

Short answer: var numbers = Enumerable.Range(1, 10); var numbers = Enumerable.Range(1, 10); var numbers = Enumerable.Range(1, 10); var numbers = Enumerable.Range(1, 10); var numbers = Enumerable.Range(1, 10); var numbers…

Mid PDF
Repeat a value 5 times?

Short answer: var fives = Enumerable.Repeat("Hi", 5); var fives = Enumerable.Repeat("Hi", 5); var fives = Enumerable.Repeat("Hi", 5); var fives = Enumerable.Repeat("Hi", 5); var fi…

Mid PDF
What does DefaultIfEmpty() do?

Short answer: What does DefaultIfEmpty() do? Returns a default value if the sequence is empty (e.g. in left join). Say this in the interview Define — one clear sentence (the short answer above). Example — relate it to a…

Mid PDF
How to write a subquery?

Short answer: var topEarners = employees .Where(e => e.Salary > employees.Average(x => x.Salary)); Example code var topEarners = employees .Where(e => e.Salary > employees.Average(x => x.Salary)); Real-…

Mid PDF
Check if a department has more than 2 employees?

Short answer: .Count(e => e.Department == "IT") > 2; .Count(e => e.Department == "IT") > 2; .Count(e => e.Department == "IT") > 2; .Count(e => e.Department == "IT&q…

Mid PDF
Check if a department has more than 2 employees?

Short answer: Check if a department has more than 2 employees? Explain a bit more bool deptCheck = employees .Count(e => e.Department == "IT") > 2; Check if a department has more than 2 employees? bool de…

Mid PDF
Create dictionary from list?

Short answer: var empDict = employees.ToDictionary(e => e.Id); var empDict = employees.ToDictionary(e => e.Id); var empDict = employees.ToDictionary(e => e.Id); var empDict = employees.ToDictionary(e => e.Id)…

Mid PDF
Sum salary by department, only if salary > 70k .Where(e => e.Salary > 70000) .GroupBy(e => e.Department)?

Short answer: var sum = employees .Select(g => new { g.Key, Sum = g.Sum(e => e.Salary) }); Example code var sum = employees .Select(g => new { g.Key, Sum = g.Sum(e => e.Salary) }); Real-world example (ShopNes…

Mid PDF
Sum salary by department, only if salary > 70k?

Short answer: Sum salary by department, only if salary > 70k Follow : var sum = employees .Where(e => e.Salary > 70000) .GroupBy(e => e.Department) .Select(g => new { g.Key, Sum = g.Sum(e => e.Salary) }…

Mid PDF
Find duplicate names .GroupBy(e => e.Name) .Where(g => g.Count() > 1)?

Short answer: var dupNames = employees .Select(g => g.Key); var dupNames = employees .Select(g => g.Key); var dupNames = employees .Select(g => g.Key); var dupNames = employees .Select(g => g.Key); var dupNam…

Mid PDF
Find duplicate names?

Short answer: Find duplicate names var dupNames = employees .GroupBy(e => e.Name) .Where(g => g.Count() > 1) .Select(g => g.Key); Find duplicate names var dupNames = employees .GroupBy(e => e.Name) .Where(…

Mid PDF
Merge two employee lists?

Short answer: var merged = list1.Union(list2); var merged = list1.Union(list2); var merged = list1.Union(list2); var merged = list1.Union(list2); var merged = list1.Union(list2); var merged = list1.Union(list2); var merg…

Mid PDF
Select only employees with even ID?

Short answer: var evens = employees.Where(e => e.Id % 2 == 0); var evens = employees.Where(e => e.Id % 2 == 0); var evens = employees.Where(e => e.Id % 2 == 0); var evens = employees.Where(e => e.Id % 2 == 0)…

Mid PDF
Group employees by first letter of name?

Short answer: var alphaGroup = employees .GroupBy(e => e.Name[0]); var alphaGroup = employees .GroupBy(e => e.Name[0]); var alphaGroup = employees .GroupBy(e => e.Name[0]); var alphaGroup = employees .GroupBy(e…

Mid PDF
Reverse the order?

Short answer: var reversed = employees.Reverse(); var reversed = employees.Reverse(); var reversed = employees.Reverse(); var reversed = employees.Reverse(); var reversed = employees.Reverse(); var reversed = employees.R…

Mid PDF
Print all names in single comma-separated string?

Short answer: string result = string.Join(", ", employees.Select(e => e.Name)); string result = string.Join(", ", employees.Select(e => e.Name)); string result = string.Join(", ", empl…

Mid PDF
Safely get the first employee or null?

Short answer: var first = employees.FirstOrDefault(); var first = employees.FirstOrDefault(); var first = employees.FirstOrDefault(); var first = employees.FirstOrDefault(); var first = employees.FirstOrDefault(); var fi…

Mid PDF
How to handle exceptions in LINQ?

Short answer: var result = employees.First(e => e.Salary > 999999); var result = employees.First(e => e.Salary > 999999); var result = employees.First(e => e.Salary > 999999); var result = employees.Fir…

Mid PDF
How to handle exceptions in LINQ?

Short answer: How to handle exceptions in LINQ? Use try-catch around enumeration, not the query: try { var result = employees.First(e => e.Salary > 999999); } catch (Exception ex) { Console.WriteLine("No match…

Mid PDF
What's the difference between Select() and SelectMany()?

Short answer: What's the difference between Select() and SelectMany()? Select() returns collection of collections. SelectMany() flattens them. Real-world example (ShopNest) ShopNest maps entities to DTOs with .Select(o =…

LINQ LINQ Tutorial · LINQ

Short answer: var query = dbContext.Employees .Where(e => CustomFunction(e.Name)); var query = dbContext.Employees .Where(e => CustomFunction(e.Name)); var query = dbContext.Employees .Where(e => CustomFunction(e.Name)); var query = dbContext.Employees .Where(e => CustomFunction(e.Name));

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.

Say this in the interview

  1. Define — one clear sentence (the short answer above).
  2. Example — relate it to a project like ShopNest or your real work.
  3. Trade-off — when you would not use it.
Permalink & share

LINQ LINQ Tutorial · LINQ

Short answer: Why use AsEnumerable()? var query = dbContext.Employees .AsEnumerable() // switch to in-memory .Where(e => CustomFunction(e.Name)); ✅ Use when your logic can't be translated to SQL. Why use AsEnumerable()? var query = dbContext.Employees .AsEnumerable() // switch to in-memory .Where(e => CustomFunction(e.Name)); ✅ Use when your… logic can't be translated… to… Why use AsEnumerable()? var query = dbContext.Employees…

Explain a bit more

AsEnumerable() // switch to in-memory .Where(e => CustomFunction(e.Name)); ✅ Use when your logic can't be translated to SQL. Why use AsEnumerable()? var query = dbContext.Employees .AsEnumerable() // switch to in-memory .Where(e => CustomFunction(e.Name)); ✅ Use when your… logic can't be translated to SQL.

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.

Say this in the interview

  1. Define — one clear sentence (the short answer above).
  2. Example — relate it to a project like ShopNest or your real work.
  3. Trade-off — when you would not use it.
Permalink & share

LINQ LINQ Tutorial · LINQ

Short answer: Detect and avoid N+1 query in EF? Use Include() to load related entities: var orders = dbContext.Orders .Include(o => o.Customer) .ToList(); Detect and avoid N+1 query in EF? Use Include() to load related entities: var orders = dbContext.Orders .Include(o => o.Customer) .ToList(); Detect and avoid N+1 query in EF? Use Include() to load related entities: var… orders = dbContext.Orders .Include(o => o.Customer)…

Explain a bit more

ToList(); Detect and avoid N+1 query in EF? Use Include() to load related entities: var orders = dbContext.Orders .Include(o => o.Customer) .ToList();

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.

Say this in the interview

  1. Define — one clear sentence (the short answer above).
  2. Example — relate it to a project like ShopNest or your real work.
  3. Trade-off — when you would not use it.
Permalink & share

LINQ LINQ Tutorial · LINQ

Short answer: How to force immediate execution? Use .ToList(), .ToArray(), .Count(), .First() etc. Follow :

Real-world example (ShopNest)

ShopNest builds a LINQ query for search filters, then calls ToListAsync() once in the repository—so the SQL runs one time, not inside a loop.

Say this in the interview

  1. Define — one clear sentence (the short answer above).
  2. Example — relate it to a project like ShopNest or your real work.
  3. Trade-off — when you would not use it.
Permalink & share

LINQ LINQ Tutorial · LINQ

Short answer: Can we use LINQ on JSON? ✅ Yes — using System.Text.Json or Newtonsoft.Json, then LINQ on parsed objects.

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.

Say this in the interview

  1. Define — one clear sentence (the short answer above).
  2. Example — relate it to a project like ShopNest or your real work.
  3. Trade-off — when you would not use it.
Permalink & share

LINQ LINQ Tutorial · LINQ

Short answer: var numbers = Enumerable.Range(1, 10); var numbers = Enumerable.Range(1, 10); var numbers = Enumerable.Range(1, 10); var numbers = Enumerable.Range(1, 10); var numbers = Enumerable.Range(1, 10); var numbers = Enumerable.Range(1, 10); var numbers = Enumerable.Range(1, 10); var numbers = Enumerable.Range(1, 10);

Example code

var numbers = Enumerable.Range(1, 10); var numbers = Enumerable.Range(1, 10); var numbers = Enumerable.Range(1, 10); var numbers = Enumerable.Range(1, 10); var numbers = Enumerable.Range(1, 10); var numbers = Enumerable.Range(1, 10); var numbers = Enumerable.Range(1, 10); var numbers = Enumerable.Range(1, 10);

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.

Say this in the interview

  1. Define — one clear sentence (the short answer above).
  2. Example — relate it to a project like ShopNest or your real work.
  3. Trade-off — when you would not use it.
Permalink & share

LINQ LINQ Tutorial · LINQ

Short answer: var fives = Enumerable.Repeat("Hi", 5); var fives = Enumerable.Repeat("Hi", 5); var fives = Enumerable.Repeat("Hi", 5); var fives = Enumerable.Repeat("Hi", 5); var fives = Enumerable.Repeat("Hi", 5); var fives = Enumerable.Repeat("Hi", 5); var fives = Enumerable.Repeat("Hi", 5); var fives = Enumerable.Repeat("Hi", 5);

Example code

var fives = Enumerable.Repeat("Hi", 5); var fives = Enumerable.Repeat("Hi", 5); var fives = Enumerable.Repeat("Hi", 5); var fives = Enumerable.Repeat("Hi", 5); var fives = Enumerable.Repeat("Hi", 5); var fives = Enumerable.Repeat("Hi", 5); var fives = Enumerable.Repeat("Hi", 5); var fives = Enumerable.Repeat("Hi", 5);

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.

Say this in the interview

  1. Define — one clear sentence (the short answer above).
  2. Example — relate it to a project like ShopNest or your real work.
  3. Trade-off — when you would not use it.
Permalink & share

LINQ LINQ Tutorial · LINQ

Short answer: What does DefaultIfEmpty() do? Returns a default value if the sequence is empty (e.g. in left join).

Say this in the interview

  1. Define — one clear sentence (the short answer above).
  2. Example — relate it to a project like ShopNest or your real work.
  3. Trade-off — when you would not use it.
Permalink & share

LINQ LINQ Tutorial · LINQ

Short answer: var topEarners = employees .Where(e => e.Salary > employees.Average(x => x.Salary));

Example code

var topEarners = employees
.Where(e => e.Salary > employees.Average(x => x.Salary));

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.

Say this in the interview

  1. Define — one clear sentence (the short answer above).
  2. Example — relate it to a project like ShopNest or your real work.
  3. Trade-off — when you would not use it.
Permalink & share

LINQ LINQ Tutorial · LINQ

Short answer: .Count(e => e.Department == "IT") > 2; .Count(e => e.Department == "IT") > 2; .Count(e => e.Department == "IT") > 2; .Count(e => e.Department == "IT") > 2; .Count(e => e.Department == "IT") > 2; .Count(e => e.Department == "IT") > 2; .Count(e => e.Department == "IT") > 2; .Count(e => e.Department == "IT") > 2;

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.

Say this in the interview

  1. Define — one clear sentence (the short answer above).
  2. Example — relate it to a project like ShopNest or your real work.
  3. Trade-off — when you would not use it.
Permalink & share

LINQ LINQ Tutorial · LINQ

Short answer: Check if a department has more than 2 employees?

Explain a bit more

bool deptCheck = employees .Count(e => e.Department == "IT") > 2; Check if a department has more than 2 employees? bool deptCheck = employees .Count(e => e.Department == "IT") > 2; Check if a department has more than 2 employees? bool deptCheck = employees .Count(e => e.Department == "IT") > 2; Check if a department has more than 2 employees? bool deptCheck = employees .Count(e => e.Department == "IT") > 2;

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.

Say this in the interview

  1. Define — one clear sentence (the short answer above).
  2. Example — relate it to a project like ShopNest or your real work.
  3. Trade-off — when you would not use it.
Permalink & share

LINQ LINQ Tutorial · LINQ

Short answer: var empDict = employees.ToDictionary(e => e.Id); var empDict = employees.ToDictionary(e => e.Id); var empDict = employees.ToDictionary(e => e.Id); var empDict = employees.ToDictionary(e => e.Id); var empDict = employees.ToDictionary(e => e.Id); var empDict = employees.ToDictionary(e => e.Id); var empDict = employees.ToDictionary(e => e.Id); var empDict = employees.ToDictionary(e => e.Id);

Example code

var empDict = employees.ToDictionary(e => e.Id); var empDict = employees.ToDictionary(e => e.Id); var empDict = employees.ToDictionary(e => e.Id); var empDict = employees.ToDictionary(e => e.Id); var empDict = employees.ToDictionary(e => e.Id); var empDict = employees.ToDictionary(e => e.Id); var empDict = employees.ToDictionary(e => e.Id); var empDict = employees.ToDictionary(e => e.Id);

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.

Say this in the interview

  1. Define — one clear sentence (the short answer above).
  2. Example — relate it to a project like ShopNest or your real work.
  3. Trade-off — when you would not use it.
Permalink & share

LINQ LINQ Tutorial · LINQ

Short answer: var sum = employees .Select(g => new { g.Key, Sum = g.Sum(e => e.Salary) });

Example code

var sum = employees
.Select(g => new { g.Key, Sum = g.Sum(e => e.Salary) });

Real-world example (ShopNest)

ShopNest filters active products with products.Where(p => p.IsActive && p.Stock > 0) before showing the catalog.

Say this in the interview

  1. Define — one clear sentence (the short answer above).
  2. Example — relate it to a project like ShopNest or your real work.
  3. Trade-off — when you would not use it.
Permalink & share

LINQ LINQ Tutorial · LINQ

Short answer: Sum salary by department, only if salary > 70k Follow : var sum = employees .Where(e => e.Salary > 70000) .GroupBy(e => e.Department) .Select(g => new { g.Key, Sum = g.Sum(e => e.Salary) }); Sum salary by department, only if salary > 70k Follow : var sum = employees .Where(e => e.Salary > 70000) .GroupBy(e => e.Department)… Select(g => new { g.Key, Sum =…… Sum salary by department, only if salary > 70k Follow : var…

Explain a bit more

sum = employees .Where(e => e.Salary > 70000) .GroupBy(e => e.Department) .Select(g => new { g.Key, Sum = g.Sum(e => e.Salary) }); Sum salary by department, only if salary > 70k Follow : var sum = employees .Where(e => e.Salary > 70000) .GroupBy(e => e.Department)… Select(g => new { g.Key, Sum = g.Sum(e => e.Salary) });

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.

Say this in the interview

  1. Define — one clear sentence (the short answer above).
  2. Example — relate it to a project like ShopNest or your real work.
  3. Trade-off — when you would not use it.
Permalink & share

LINQ LINQ Tutorial · LINQ

Short answer: var dupNames = employees .Select(g => g.Key); var dupNames = employees .Select(g => g.Key); var dupNames = employees .Select(g => g.Key); var dupNames = employees .Select(g => g.Key); var dupNames = employees .Select(g => g.Key); var dupNames = employees .Select(g => g.Key); var dupNames = employees .Select(g => g.Key); var dupNames = employees .Select(g => g.Key);

Example code

var dupNames = employees .Select(g => g.Key); var dupNames = employees .Select(g => g.Key); var dupNames = employees .Select(g => g.Key); var dupNames = employees .Select(g => g.Key); var dupNames = employees .Select(g => g.Key); var dupNames = employees .Select(g => g.Key); var dupNames = employees .Select(g => g.Key); var dupNames = employees .Select(g => g.Key);

Real-world example (ShopNest)

ShopNest filters active products with products.Where(p => p.IsActive && p.Stock > 0) before showing the catalog.

Say this in the interview

  1. Define — one clear sentence (the short answer above).
  2. Example — relate it to a project like ShopNest or your real work.
  3. Trade-off — when you would not use it.
Permalink & share

LINQ LINQ Tutorial · LINQ

Short answer: Find duplicate names var dupNames = employees .GroupBy(e => e.Name) .Where(g => g.Count() > 1) .Select(g => g.Key); Find duplicate names var dupNames = employees .GroupBy(e => e.Name) .Where(g => g.Count() > 1) .Select(g => g.Key); Find duplicate names var dupNames = employees .GroupBy(e => e.Name) .Where(g => g.Count() > 1) .Select(g => g.Key); Find… duplicate names var dupNames = employees .GroupBy(e => e.Name)…

Explain a bit more

Where(g => g.Count() > 1) .Select(g => g.Key);

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.

Say this in the interview

  1. Define — one clear sentence (the short answer above).
  2. Example — relate it to a project like ShopNest or your real work.
  3. Trade-off — when you would not use it.
Permalink & share

LINQ LINQ Tutorial · LINQ

Short answer: var merged = list1.Union(list2); var merged = list1.Union(list2); var merged = list1.Union(list2); var merged = list1.Union(list2); var merged = list1.Union(list2); var merged = list1.Union(list2); var merged = list1.Union(list2); var merged = list1.Union(list2);

Example code

var merged = list1.Union(list2); var merged = list1.Union(list2); var merged = list1.Union(list2); var merged = list1.Union(list2); var merged = list1.Union(list2); var merged = list1.Union(list2); var merged = list1.Union(list2); var merged = list1.Union(list2);

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.

Say this in the interview

  1. Define — one clear sentence (the short answer above).
  2. Example — relate it to a project like ShopNest or your real work.
  3. Trade-off — when you would not use it.
Permalink & share

LINQ LINQ Tutorial · LINQ

Short answer: var evens = employees.Where(e => e.Id % 2 == 0); var evens = employees.Where(e => e.Id % 2 == 0); var evens = employees.Where(e => e.Id % 2 == 0); var evens = employees.Where(e => e.Id % 2 == 0);

Real-world example (ShopNest)

ShopNest maps entities to DTOs with .Select(o => new OrderSummaryDto { Id = o.Id, Total = o.Total }) so the API does not leak internal fields.

Say this in the interview

  1. Define — one clear sentence (the short answer above).
  2. Example — relate it to a project like ShopNest or your real work.
  3. Trade-off — when you would not use it.
Permalink & share

LINQ LINQ Tutorial · LINQ

Short answer: var alphaGroup = employees .GroupBy(e => e.Name[0]); var alphaGroup = employees .GroupBy(e => e.Name[0]); var alphaGroup = employees .GroupBy(e => e.Name[0]); var alphaGroup = employees .GroupBy(e => e.Name[0]); var alphaGroup = employees .GroupBy(e => e.Name[0]); var alphaGroup = employees .GroupBy(e => e.Name[0]); var alphaGroup = employees .GroupBy(e => e.Name[0]); var alphaGroup = employees .GroupBy(e =>…

Example code

var alphaGroup = employees .GroupBy(e => e.Name[0]); var alphaGroup = employees .GroupBy(e => e.Name[0]); var alphaGroup = employees .GroupBy(e => e.Name[0]); var alphaGroup = employees .GroupBy(e => e.Name[0]); var alphaGroup = employees .GroupBy(e => e.Name[0]); var alphaGroup = employees .GroupBy(e => e.Name[0]); var alphaGroup = employees .GroupBy(e => e.Name[0]); var alphaGroup = employees .GroupBy(e => e.Name[0]);

Real-world example (ShopNest)

A sales report joins orders and customers, then GroupBy(c => c.City) to show revenue per city.

Say this in the interview

  1. Define — one clear sentence (the short answer above).
  2. Example — relate it to a project like ShopNest or your real work.
  3. Trade-off — when you would not use it.
Permalink & share

LINQ LINQ Tutorial · LINQ

Short answer: var reversed = employees.Reverse(); var reversed = employees.Reverse(); var reversed = employees.Reverse(); var reversed = employees.Reverse(); var reversed = employees.Reverse(); var reversed = employees.Reverse(); var reversed = employees.Reverse(); var reversed = employees.Reverse();

Example code

var reversed = employees.Reverse(); var reversed = employees.Reverse(); var reversed = employees.Reverse(); var reversed = employees.Reverse(); var reversed = employees.Reverse(); var reversed = employees.Reverse(); var reversed = employees.Reverse(); var reversed = employees.Reverse();

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.

Say this in the interview

  1. Define — one clear sentence (the short answer above).
  2. Example — relate it to a project like ShopNest or your real work.
  3. Trade-off — when you would not use it.
Permalink & share

LINQ LINQ Tutorial · LINQ

Short answer: string result = string.Join(", ", employees.Select(e => e.Name)); string result = string.Join(", ", employees.Select(e => e.Name)); string result = string.Join(", ", employees.Select(e => e.Name)); string result = string.Join(", ", employees.Select(e => e.Name)); string result = string.Join(", ", employees.Select(e => e.Name)); string result = string.Join(", ", employees.Select(e => e.Name)); string result =…

Explain a bit more

string.Join(", ", employees.Select(e => e.Name)); string result = string.Join(", ", employees.Select(e => e.Name));

Example code

string result = string.Join(", ", employees.Select(e => e.Name)); string result = string.Join(", ", employees.Select(e => e.Name)); string result = string.Join(", ", employees.Select(e => e.Name)); string result = string.Join(", ", employees.Select(e => e.Name)); string result = string.Join(", ", employees.Select(e => e.Name)); string result = string.Join(", ", employees.Select(e => e.Name)); string result = string.Join(", ", employees.Select(e => e.Name)); string result = string.Join(", ", employees.Select(e => e.Name));

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.

Say this in the interview

  1. Define — one clear sentence (the short answer above).
  2. Example — relate it to a project like ShopNest or your real work.
  3. Trade-off — when you would not use it.
Permalink & share

LINQ LINQ Tutorial · LINQ

Short answer: var first = employees.FirstOrDefault(); var first = employees.FirstOrDefault(); var first = employees.FirstOrDefault(); var first = employees.FirstOrDefault(); var first = employees.FirstOrDefault(); var first = employees.FirstOrDefault(); var first = employees.FirstOrDefault(); var first = employees.FirstOrDefault();

Example code

var first = employees.FirstOrDefault(); var first = employees.FirstOrDefault(); var first = employees.FirstOrDefault(); var first = employees.FirstOrDefault(); var first = employees.FirstOrDefault(); var first = employees.FirstOrDefault(); var first = employees.FirstOrDefault(); var first = employees.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.

Say this in the interview

  1. Define — one clear sentence (the short answer above).
  2. Example — relate it to a project like ShopNest or your real work.
  3. Trade-off — when you would not use it.
Permalink & share

LINQ LINQ Tutorial · LINQ

Short answer: var result = employees.First(e => e.Salary > 999999); var result = employees.First(e => e.Salary > 999999); var result = employees.First(e => e.Salary > 999999); var result = employees.First(e => e.Salary > 999999); var result = employees.First(e => e.Salary > 999999); var result = employees.First(e => e.Salary > 999999); var result = employees.First(e => e.Salary > 999999); var result = employees.First(e =>…

Example code

var result = employees.First(e => e.Salary > 999999); var result = employees.First(e => e.Salary > 999999); var result = employees.First(e => e.Salary > 999999); var result = employees.First(e => e.Salary > 999999); var result = employees.First(e => e.Salary > 999999); var result = employees.First(e => e.Salary > 999999); var result = employees.First(e => e.Salary > 999999); var result = employees.First(e => e.Salary > 999999);

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.

Say this in the interview

  1. Define — one clear sentence (the short answer above).
  2. Example — relate it to a project like ShopNest or your real work.
  3. Trade-off — when you would not use it.
Permalink & share

LINQ LINQ Tutorial · LINQ

Short answer: How to handle exceptions in LINQ? Use try-catch around enumeration, not the query: try { var result = employees.First(e => e.Salary > 999999); } catch (Exception ex) { Console.WriteLine("No match found."); How to handle exceptions in LINQ? How to handle exceptions in LINQ? Use try-catch around enumeration, not the query: try { var result =… employees.First(e… => e.Salary > 999999); } catch (Exception ex) {…

Explain a bit more

Console.WriteLine("No match found."); How to handle exceptions in LINQ?

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.

Say this in the interview

  1. Define — one clear sentence (the short answer above).
  2. Example — relate it to a project like ShopNest or your real work.
  3. Trade-off — when you would not use it.
Permalink & share

LINQ LINQ Tutorial · LINQ

Short answer: What's the difference between Select() and SelectMany()? Select() returns collection of collections. SelectMany() flattens them.

Real-world example (ShopNest)

ShopNest maps entities to DTOs with .Select(o => new OrderSummaryDto { Id = o.Id, Total = o.Total }) so the API does not leak internal fields.

Say this in the interview

  1. Define — one clear sentence (the short answer above).
  2. Example — relate it to a project like ShopNest or your real work.
  3. Trade-off — when you would not use it.
Permalink & share
Toolliyo Assistant
Ask about tutorials, ebooks, training, pricing, mentor services, and support. I use public site content only—not admin or internal tools.

care@toolliyo.com

Need callback? Share your details