Skip to content

Commit

Permalink
fix name of equality comparer to *_CustomComparer
Browse files Browse the repository at this point in the history
  • Loading branch information
artemious7 committed Apr 30, 2021
1 parent e952128 commit 6ffc0b4
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions doc/Equality Generation.md
Expand Up @@ -160,7 +160,7 @@ of it).
generator from generating this method. (actually, it will be generated,
but the code will be commented-out, so you'll be able to sneak at it).
1. The comparer for a field can be overriden by specifying a
`private static` read-only property named <Field/Property name> + "`_Comparer`"
`private static` read-only property named <Field/Property name> + "`_CustomComparer`"
and of type `IEqualityComparer`
1. For `string`, a `StringComparer.Ordinal` will be used by default. If you
need a different one you can specify a _custom equality comparer_.
Expand All @@ -177,7 +177,7 @@ this order:
1. The `.Count` will be compared (return `false` if `Count` is different)
1. Each item of the collection will be compared by reapplying those rules.
1. **Custom Equality Comparer**: If there's a **Private**, **Static** &
**Read-Only** field with the name <Field/Propertyname>`_Comparer`
**Read-only** property with the name <Field/Propertyname>`_CustomComparer`
of type `IEqualityComparer`, it will be used to compare the value. Example:
``` csharp
public partial class Person
Expand All @@ -186,7 +186,7 @@ this order:

// Default comparer for `Name` property
// Tip: You can create another .cs file to keep your entity "clean"
private static readonly IEqualityComparer Name_Comparer = StringComparer.Ordinal;
private static IEqualityComparer Name_CustomComparer { get; } = StringComparer.Ordinal;
}
```
1. If the type of the field/property is a string,
Expand Down

0 comments on commit 6ffc0b4

Please sign in to comment.