Browse by Topic

Popular

Latest

Latest Posts

C# tuple deconstruction concept showing a tuple being split into separate variables
C#

C# Tuple Deconstruction: Syntax and Practical Use

c# tuple deconstruction: Learn C# tuple deconstruction to unpack tuple values into variables, including discards, custom types, and practical patterns.

C#TuplesDeconstruction.NET
Conceptual illustration of a C# named tuple with labeled fields and a value type container.
C#

C# Named Tuples: Syntax and Practical Usage

Learn how to declare, access, and return C# named tuples, and understand when they are a better choice than anonymous types.

C#Named TuplesTuplesDeconstruction
A C# method returning a tuple with two named values, illustrating multiple return values.
C#

C# Tuple Multiple Return Values: Syntax and Usage

Learn how to use C# tuples to return multiple values from methods. This guide covers tuple syntax, named elements, deconstruction, ValueTuple performance tradeoffs, and when to choose a custom class or record instead.

C#TuplesValueTupleMethod Returns
Diagram showing C# tuple declaration with named members and deconstruction.
C#

C# Tuple Declaration: Syntax and Usage

c# tuple declaration: Learn C# tuple declaration syntax, named members, deconstruction, and when to use ValueTuple over custom types.

C# tuplesValueTupletuple syntaxdeconstruction
Diagram showing two distinct values being grouped into a single tuple container with named member labels
C#

C# Tuple Usage: Syntax, Deconstruction, and Tradeoffs

c# tuple usage: Practical C# tuple usage: declaration syntax, named members, deconstruction, method returns, and when a tuple beats a custom type.

C#ValueTupletuple deconstructionnamed members
Diagram showing a C# positional record declaration and its generated properties and equality behavior.
C#

C# Positional Record: Syntax and Behavior

C# positional records provide a concise syntax for immutable data models. Learn how the compiler generates properties, value equality, deconstruction, and when to prefer records over classes.

C#recordspositional recordsvalue equality
Illustration of a C# record being split into separate variables, representing deconstruction.
C#

C# Record Deconstruct: Extract Fields Cleanly

Learn how C# record deconstruction extracts fields into variables. Includes positional records, custom Deconstruct methods, discards, pattern matching, and common pitfalls.

C#RecordsDeconstructionSyntax
Two identical record boxes being compared with a checkmark, symbolizing value-based equality in C#.
C#

C# Record Equality: How It Works and When to Customize

Understand how C# records implement value-based equality, when the default behavior is sufficient, and when to override Equals and GetHashCode for collections or custom rules.

C# recordsvalue equalityGetHashCodeEqualityContract
Diagram showing a C# record being copied with a with expression to create a modified instance
C#

C# Record with Expression: Copy and Modify Records

Learn how to use C# with expressions to create modified copies of immutable records, with practical examples and limitations.

C#RecordsImmutabilityWith Expression
Illustration of a C# record constructor showing generated code and init-only properties
C#

C# Record Constructor: Syntax and Customization

C# record constructors: how positional parameters generate a primary constructor, when to replace it, validation, record structs, and the copy constructor used by with expressions.

C# RecordsPrimary ConstructorsRecord StructsInit-only Properties