Skip to content

Commit e31f197

Browse files
committed
Switch to EquatableArray<T> for messenger generator
1 parent 7810fdc commit e31f197

File tree

1 file changed

+1
-34
lines changed

1 file changed

+1
-34
lines changed

CommunityToolkit.Mvvm.SourceGenerators/Messaging/Models/RecipientInfo.cs

Lines changed: 1 addition & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -17,37 +17,4 @@ namespace CommunityToolkit.Mvvm.SourceGenerators.Input.Models;
1717
/// <param name="FilenameHint">The filename hint for the current type.</param>
1818
/// <param name="TypeName">The fully qualified type name of the target type.</param>
1919
/// <param name="MessageTypes">The name of messages being received.</param>
20-
internal sealed record RecipientInfo(
21-
string FilenameHint,
22-
string TypeName,
23-
ImmutableArray<string> MessageTypes)
24-
{
25-
/// <inheritdoc/>
26-
public bool Equals(RecipientInfo? obj) => Comparer.Default.Equals(this, obj);
27-
28-
/// <inheritdoc/>
29-
public override int GetHashCode() => Comparer.Default.GetHashCode(this);
30-
31-
/// <summary>
32-
/// An <see cref="IEqualityComparer{T}"/> implementation for <see cref="RecipientInfo"/>.
33-
/// </summary>
34-
private sealed class Comparer : Comparer<RecipientInfo, Comparer>
35-
{
36-
/// <inheritdoc/>
37-
protected override void AddToHashCode(ref HashCode hashCode, RecipientInfo obj)
38-
{
39-
hashCode.Add(obj.FilenameHint);
40-
hashCode.Add(obj.TypeName);
41-
hashCode.AddRange(obj.MessageTypes);
42-
}
43-
44-
/// <inheritdoc/>
45-
protected override bool AreEqual(RecipientInfo x, RecipientInfo y)
46-
{
47-
return
48-
x.FilenameHint == y.FilenameHint &&
49-
x.TypeName == y.TypeName &&
50-
x.MessageTypes.SequenceEqual(y.MessageTypes);
51-
}
52-
}
53-
}
20+
internal sealed record RecipientInfo(string FilenameHint, string TypeName, EquatableArray<string> MessageTypes);

0 commit comments

Comments
 (0)