Browse by Topic

Popular

Latest

Latest Posts

Illustration of a C# event declaration connecting an event source to multiple handler nodes.
C#

C# Event Declaration: Syntax, Behavior, and Pitfalls

Learn the syntax for declaring C# events, safe ways to raise them, and the difference between events and delegate fields.

C# eventsdelegatesevent handlersEventHandler<T>
A diagram showing a publisher object raising an event to multiple subscriber handlers in C#.
C#

C# Event Usage: Declaring, Raising, and Handling Events

Learn how to declare, raise, and handle events in C# with practical examples, thread-safety considerations, and memory-leak prevention.

C#EventsDelegatesEventHandler
Illustration of a C# lambda expression using an underscore discard for an unused parameter.
C#

C# Discard Lambda Parameter: When and How to Use It

Learn how C# 9 lambda discard parameters use `_` for unused inputs, when they improve clarity, and how they apply to delegates, event handlers, and LINQ.

C#Lambda ExpressionsDiscardsDelegates
Illustration of a C# static lambda symbol with a lock indicating no capture.
C#

C# Static Lambda: Syntax, Benefits, and Usage

Learn how C# static lambdas avoid capturing instance state, reduce allocations, and improve performance in delegate-heavy code.

C#Lambda ExpressionsStatic Anonymous FunctionsDelegates
Diagram illustrating how a C# lambda captures variables from its enclosing scope, forming a closure.
C#

C# Lambda Variable Capture: Closures and Pitfalls

Learn how C# lambda expressions capture variables, why foreach and for loops behave differently, and how closures affect memory and performance.

lambda expressionsclosuresvariable captureC# loops
Diagram showing a lambda expression capturing a local variable from its enclosing scope in C#.
C#

C# Lambda Closure: Variable Capture Explained

Learn how C# lambda closures capture variables, why captured state lives as long as the delegate, and how to avoid common pitfalls like loop variable capture.

C#lambda expressionsclosuresvariable capture
Diagram comparing C# lambda expression and delegate syntax with a callable method reference.
C#

C# Lambda vs Delegate: When to Use Each

c# lambda vs delegate: Understand the practical differences between C# lambda expressions and delegates, including syntax, variable capture, and allocation behavior, t...

C#Lambda ExpressionsDelegatesAnonymous Methods
Diagram showing a C# statement lambda with a block body and multiple statements.
C#

C# Statement Lambda: Syntax and Practical Usage

Learn C# statement lambdas, their syntax, how they differ from expression lambdas, and when to use them in delegates, LINQ, and async code.

C#lambda expressionsdelegatesLINQ
Diagram showing a C# expression lambda arrow transforming an input into an output, representing the syntax and usage.
C#

C# Expression Lambda: Syntax and Practical Usage

c# expression lambda: Learn C# expression lambda syntax, how it differs from statement lambdas, and where it fits in LINQ, delegates, and expression trees.

C#Lambda ExpressionsLINQExpression Trees
Diagram showing a C# lambda arrow pointing to a return value box, illustrating how the expression body produces the delegate's result.
C#

C# Lambda Return Value: Syntax and Behavior

Learn how C# lambdas produce return values: expression vs. statement lambdas, return-type inference with Func delegates, and common pitfalls to avoid.

C# LambdasFunc DelegatesType InferenceLINQ