All syntax guides
Short, practical guides on programming syntax, language fundamentals, and the tools developers reach for every day.
3,980 guides across 14 topics
Topics
Popular guides
Most readLatest guides
Page 333 of 398C# IComparable vs IComparer: When to Use Each
Understand the difference between IComparable and IComparer in C#, see how to implement both interfaces, and learn when each one fits sorting and comparison logic.
Implementing IComparable in C# for Reliable Sorting
c# icomparable: Learn how to implement IComparable<T> in C# for custom sorting, including CompareTo semantics, null handling, and consistency with Equals.
C# Comparable: Implementing IComparable for Sorting
Learn how to implement IComparable<T> in C# to sort custom objects with List.Sort and Array.Sort, including null handling and common edge cases.
C# Record Equality vs Class Equality Explained
C# records and classes differ in equality behavior. Learn how value semantics work, when reference equality still matters, and how to customize record equality.
C# Reference Equality vs Value Equality
c# reference equality vs value equality: Understand the difference between reference equality and value equality in C#, how to implement custom equality, and when reco...
C# Equality Comparer: Implementing IEqualityComparer<T>
Learn how to implement a C# equality comparer with IEqualityComparer<T> for LINQ and Dictionary, including GetHashCode rules and performance considerations.
C# Discard Pattern: Syntax and Practical Use Cases
Learn how to use C# discards with out parameters, deconstruction, and pattern matching, plus common pitfalls to avoid.
C# var Pattern: Syntax, Use Cases, and Pitfalls
c# var pattern: Learn how the C# var pattern works, where it fits in pattern matching, and when it's useful versus other patterns.
C# Iterator Deferred Execution
In C#, iterator methods that use yield return defer execution until enumeration. This article covers state-machine behavior, exception timing, side effects, and when to materialize a sequence.
Understanding IEnumerator in C#
c# ienumerator: Learn how IEnumerator powers foreach in C#, how to implement custom enumerators manually or with yield, and the performance tradeoffs to consider.