Junior — Middle
Have you worked with LINQ for data queries?.
sobes.tech AI
Answer from AI
Yes, I have used LINQ for convenient and expressive data querying in C#. LINQ allows working with collections, databases, and other data sources using a unified syntax.
An example of using LINQ for filtering and sorting a list:
using System;
using System.Linq;
using System.Collections.Generic;
class Program
{
static void Main()
{
List<int> numbers = new List<int> { 5, 10, 3, 8, 1 };
var filtered = numbers.Where(n => n > 3).OrderBy(n => n);
foreach(var num in filtered)
{
Console.WriteLine(num);
}
}
}
LINQ simplifies working with data, making the code more readable and maintainable.