[Everyday C#] Fundamentals: Equality comparisons#54849
Merged
Merged
Conversation
Add fundamentals concept article on object equality for classes, structs, records, and tuples. Covers value equality vs. reference equality, Equals/==/ReferenceEquals semantics, IEquatable<T> implementation pattern, and record compiler-generated equality. Backed by a net10.0 snippet project (0 warnings, 0 errors). Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 5dca83ef-a274-4737-96d5-a311bfe58550
Relocate the Equality fundamentals article and snippets from Type system to the new Expressions folder, and update the TOC and relative links for the new location. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: bc6b7895-3b18-45ff-99de-540618819cb3
Clarify default equality behavior, operator terminology, and manual value equality guidance. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: bc6b7895-3b18-45ff-99de-540618819cb3
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: bc6b7895-3b18-45ff-99de-540618819cb3
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: bc6b7895-3b18-45ff-99de-540618819cb3
Deemphasize the value of IEquatable<T> throughout the article.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: bc6b7895-3b18-45ff-99de-540618819cb3
Contributor
There was a problem hiding this comment.
Pull request overview
Adds a new Everyday C# Fundamentals article that explains equality comparisons across common C# type categories, backed by a buildable snippet project, and wires the article into the C# TOC.
Changes:
- Adds a new article:
fundamentals/expressions/equality.md. - Adds a buildable snippet project under
fundamentals/expressions/snippets/equality/used by the article. - Updates the C# TOC to link the new article under Expressions and statements.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| docs/csharp/toc.yml | Adds a TOC entry for the new equality article. |
| docs/csharp/fundamentals/expressions/equality.md | Introduces the new equality comparisons article and references snippets. |
| docs/csharp/fundamentals/expressions/snippets/equality/Program.cs | Adds runnable examples demonstrating default equality behavior and IEquatable<T>. |
| docs/csharp/fundamentals/expressions/snippets/equality/equality.csproj | Adds a minimal project file to build and run the snippet code. |
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Run another edit pass on this PR.
This organization of the material works much better.
BillWagner
marked this pull request as ready for review
July 22, 2026 18:29
wadepickett
reviewed
Jul 22, 2026
wadepickett
reviewed
Jul 22, 2026
wadepickett
reviewed
Jul 22, 2026
wadepickett
approved these changes
Jul 22, 2026
wadepickett
left a comment
Contributor
There was a problem hiding this comment.
@BillWagner: Approved, great work! See my few very minor suggestions inline that you could take or leave.
Co-authored-by: Wade Pickett <wpickett@microsoft.com>
BillWagner
enabled auto-merge (squash)
July 23, 2026 16:00
wadepickett
approved these changes
Jul 23, 2026
wadepickett
left a comment
Contributor
There was a problem hiding this comment.
@BillWagner , re-approved.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #54112
Phase E / PR 14b of the Everyday C# Fundamentals restructuring.
Summary:
docs/csharp/fundamentals/expressions/equality.mdin the newfundamentals/expressions/folder, added to the TOC under "Expressions and statements".==,!=,Equals,GetHashCode,ReferenceEquals), and how to add value equality by hand (with a record-first IMPORTANT callout).snippets/equality/), verifieddotnet build0 warnings/0 errors on net10.0 withdotnet runoutput matching the article.operators.mdis intentionally deferred to PR 16 and is not included here.Internal previews