|
61 | 61 | |
62 | 62 | The <xref:System.IEquatable%601> interface is used by generic collection objects such as <xref:System.Collections.Generic.Dictionary%602>, <xref:System.Collections.Generic.List%601>, and <xref:System.Collections.Generic.LinkedList%601> when testing for equality in such methods as `Contains`, `IndexOf`, `LastIndexOf`, and `Remove`. It should be implemented for any object that might be stored in a generic collection. |
63 | 63 | |
64 | | - See remarks on the <xref:System.IEquatable%601.Equals%2A?displayProperty=nameWithType> for more information about implementing the <xref:System.IEquatable%601> interface. |
| 64 | +For more information about implementing the <xref:System.IEquatable%601> interface, see remarks on the <xref:System.IEquatable%601.Equals%2A?displayProperty=nameWithType> method. |
65 | 65 |
|
66 | 66 | ## Examples |
67 | 67 | The following example shows the partial implementation of a `Person` class that implements <xref:System.IEquatable%601> and has two properties, `LastName` and `NationalId`. `NationalId` is considered to be a unique identifier, therefore the <xref:System.IEquatable%601.Equals%2A> method returns `True` if the `NationalId` property of two `Person` objects is identical; otherwise, it returns `False`. |
68 | | - Note that the F# example does not handle `null` values for `Person` instances. |
| 68 | + (Note that the F# example does not handle `null` values for `Person` instances.) |
69 | 69 | |
70 | 70 | :::code language="csharp" source="~/snippets/csharp/System/IEquatableT/Equals/EqualsExample.cs" id="Person"::: |
71 | 71 | :::code language="fsharp" source="~/snippets/fsharp/System/IEquatableT/Equals/EqualsExample.fs" id="Person"::: |
|
169 | 169 | |
170 | 170 | ## Examples |
171 | 171 | The following example shows the partial implementation of a `Person` class that implements <xref:System.IEquatable%601> and has two properties, `LastName` and `NationalId`. `NationalId` is considered to be a unique identifier, therefore the <xref:System.IEquatable%601.Equals%2A> method returns `True` if the `NationalId` property of two `Person` objects is identical; otherwise, it returns `False`. |
172 | | - Note that the F# example does not handle `null` values for `Person` instances. |
| 172 | + (Note that the F# example does not handle `null` values for `Person` instances.) |
173 | 173 | |
174 | 174 | :::code language="csharp" source="~/snippets/csharp/System/IEquatableT/Equals/EqualsExample.cs" id="Person"::: |
175 | 175 | :::code language="fsharp" source="~/snippets/fsharp/System/IEquatableT/Equals/EqualsExample.fs" id="Person"::: |
176 | 176 | :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.GenericIEquatable.Equals/vb/EqualsExample.vb" id="Person"::: |
177 | 177 | |
178 | | - When a `Person` is stored in a <xref:System.Collections.Generic.List%601>, `Contains` will use its' <xref:System.IEquatable%601.Equals%2A> implementation to find a match. |
| 178 | + When a `Person` is stored in a <xref:System.Collections.Generic.List%601>, `Contains` uses its <xref:System.IEquatable%601.Equals%2A> implementation to search for a match. |
179 | 179 | |
180 | 180 | :::code language="csharp" source="~/snippets/csharp/System/IEquatableT/Equals/EqualsExample.cs" id="PersonSample"::: |
181 | 181 | :::code language="fsharp" source="~/snippets/fsharp/System/IEquatableT/Equals/EqualsExample.fs" id="PersonSample"::: |
|
0 commit comments