Browse by Topic

Popular

Latest

Latest C# Posts

Comparison of C# using statement and Dispose method for resource management
C#

C# using vs Dispose: When to Use Each

Understand the difference between C#'s using statement and calling Dispose directly, with practical guidance for IDisposable cleanup and exception safety.

C#IDisposableusing statementresource management
Diagram contrasting explicit Dispose calls with garbage collector finalization timing in C#.
C#

C# Dispose vs Destructor: Key Differences Explained

c# dispose vs destructor: Understand the difference between Dispose and destructors in C#, when each runs, and how to manage unmanaged resources correctly.

IDisposableFinalizerGarbage CollectionResource Management
Diagram showing a C# lambda expression with a default value assigned to a parameter, highlighting C# 12 syntax.
C#

C# Lambda Default Parameters: Syntax and Limits

Learn how to use default values in C# lambda expressions: C# 12 syntax, compile-time rules, call-site behavior, and workarounds for older versions.

C#LambdaDefault ParametersC# 12
Diagram illustrating C# primary constructor class syntax with parameters and class body.
C#

C# Primary Constructors for Classes: Syntax and Usage

Learn how to use C# primary constructors for classes: syntax, initialization, dependency injection, and limitations with practical examples.

C#Primary ConstructorsClass DesignDependency Injection
Illustration of C# reflection retrieving attributes from a class member
C#

C# Reflection: Get Attributes from Types and Members

Learn how to use C# reflection to retrieve custom attributes from types and members, including inheritance behavior and performance considerations.

ReflectionAttributesC#Metadata
Illustration of sorting elements using a custom IComparer in C#
C#

C# IComparer: Custom Sorting with IComparer<T>

Learn how to implement IComparer<T> in C# to define custom sort order for arrays and lists, handle nulls, and avoid common performance pitfalls.

IComparerC# SortingComparison<T>Custom Comparer
Diagram showing the relationship between async, await, and Task in C#
C#

C# async/await and Task Relationship Explained

Understand how C# async, await, and Task fit together: how async methods return Task, when await suspends execution, and how exceptions propagate across the task boundary.

asyncawaitTaskasynchronous programming
Comparison of Object.Equals and ReferenceEquals in C# showing two objects with same value but different references.
C#

C# Object.Equals vs ReferenceEquals: Key Differences

Object.Equals and ReferenceEquals answer different questions in C#: value equality vs reference identity. Learn how each works, when to override Equals, and common pitfalls.

C#Object.EqualsReferenceEqualsvalue equality
Illustration comparing the == operator and Equals method for string comparison in C#.
C#

C# String Equals vs ==: What’s the Difference?

Understand the difference between == and Equals when comparing strings in C#, including reference equality, interning, and culture-sensitive comparisons.

C#String ComparisonEquality.NET
Comparison of List.Find and LINQ First in C# showing search behavior and default values.
C#

C# List Find vs LINQ First: Which to Use

Compare List<T>.Find with LINQ First and FirstOrDefault in C#: syntax, behavior, performance, and when to use each.

C#LINQList<T>FirstOrDefault