C# guides
Every published C# guide, newest first, with practical examples you can copy into your own project.
3,965 guides across 14 topics
Topics
Popular C# guides
Most readLatest C# guides
Page 23 of 77C# Shallow Copy vs Deep Copy
Understand the difference between shallow and deep copying in C#, how to implement each, and when to choose one over the other.
C# Object Casting and Boxing: How Type Conversion Works
Understand how C# object casting and boxing work, the runtime cost of boxing, common unboxing errors, and when to prefer generics over object conversions.
C# Boxing Performance: Avoiding Hidden Allocations
c# boxing performance: Learn how boxing affects C# performance, where hidden allocations occur, and how generics help you avoid them in hot paths.
Demystifying C# Unboxing
Practical C# unboxing guide: runtime mechanics, InvalidCastException pitfalls, nullable value behavior, and generic alternatives that reduce boxing.
C# Boxing Examples: How Value Types Behave
C# boxing with practical examples: the heap allocation, the exact-type unboxing rule, hidden boxing in APIs and collections, and how generics remove it.
C# Boxing vs Unboxing: How They Affect Performance
Understand how C# boxing and unboxing work, why boxing can add allocations, and how to reduce unnecessary conversions in performance-sensitive code.
C# Custom Sorting with Comparers and LINQ
Learn how to implement custom sorting in C# with IComparer, Comparison delegates, and LINQ OrderBy, including practical examples and performance considerations.
Creating Custom Comparers in C# for Sorting and Equality
Learn how to create custom comparers in C# to control sorting and equality in LINQ, collections, and dictionaries.
Implementing IEquatable<T> in C# for Efficient Equality Checks
Implement IEquatable<T> in C# to define typed equality checks, avoid boxing for structs, and keep hash-based collections consistent. Includes examples for value types and reference types, plus common pitfalls.
C# GetHashCode: Contract and Correct Overrides
Learn how GetHashCode works in C#, why it matters for Dictionary and HashSet, and how to override it correctly alongside Equals.