Master Csharp Programming with 50 free flashcards. Study using spaced repetition and focus mode for effective learning in Programming.
LINQ (Language Integrated Query) is a set of features that allows you to write query expressions directly in C# to filter, sort, and transform data from collections, databases, and XML.var results = list.Where(x => x > 5).OrderBy(x => x);
Query syntax resembles SQL:var q = from x in list where x > 5 select x;
Method syntax uses extension methods:var q = list.Where(x => x > 5);
Both compile to the same IL code.
Select projects each element of a sequence into a new form (a transformation/map operation).var names = people.Select(p => p.Name);
It returns an IEnumerable<T> of the projected type.
Deferred execution means a LINQ query is not executed when defined, but only when the results are enumerated (e.g., via foreach, ToList(), or Count()). This allows efficient chaining of operations.
GroupBy groups elements by a key:var groups = students.GroupBy(s => s.Grade);
Each group implements IGrouping<TKey, TElement> with a Key property and a collection of elements.
async/await is a language feature for writing asynchronous code that looks synchronous.async Task<string> FetchAsync() {
var data = await httpClient.GetStringAsync(url);
return data;
}
It frees the calling thread while awaiting I/O operations.
The async keyword marks a method as asynchronous, enabling the use of await inside it. It does not make the method run on a separate thread by itself; it allows the compiler to generate a state machine for asynchronous continuations.
await asynchronously waits for a Task or Task<T> to complete.
It suspends the method's execution and returns control to the caller until the awaited task finishes, then resumes from where it left off.
Task represents an asynchronous operation that does not return a value (like void).Task<T> represents an asynchronous operation that returns a value of type T.Use Task for fire-and-forget style async methods and Task<T> when you need a result.
A delegate is a type-safe function pointer that holds a reference to a method with a specific signature.delegate int MathOp(int a, int b);
MathOp add = (a, b) => a + b;
Delegates are the foundation for events and callbacks.
Action – a delegate that returns void. E.g., Action<string> log = msg => Console.WriteLine(msg);Func – a delegate that returns a value. The last type parameter is the return type. E.g., Func<int, int, int> add = (a, b) => a + b;
A multicast delegate holds references to multiple methods. When invoked, all methods in the invocation list are called in order.Action greet = () => Console.Write("Hi ");
greet += () => Console.Write("there!");
greet(); // outputs: Hi there!
Flashcards
Flip to reveal
Focus Mode
Spaced repetition
Multiple Choice
Test your knowledge
Type Answer
Active recall
Learn Mode
Multi-round mastery
Match Game
Memory challenge