mirror of
https://github.com/CommunityToolkit/dotnet.git
synced 2026-10-20 06:07:37 +08:00
Minor (possible) bug fix
This commit is contained in:
@@ -638,9 +638,14 @@ namespace Microsoft.Toolkit.Mvvm.Messaging
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public bool Equals(Type2 other)
|
||||
{
|
||||
// We can't just use reference equality, as that's technically not guaranteed
|
||||
// to work and might fail in very rare cases (eg. with type forwarding between
|
||||
// different assemblies). Instead, we can use the == operator to compare for
|
||||
// equality, which still avoids the callvirt overhead of calling Type.Equals,
|
||||
// and is also implemented as a JIT intrinsic on runtimes such as .NET Core.
|
||||
return
|
||||
ReferenceEquals(this.tMessage, other.tMessage) &&
|
||||
ReferenceEquals(this.tToken, other.tToken);
|
||||
this.tMessage == other.tMessage &&
|
||||
this.tToken == other.tToken;
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
|
||||
Reference in New Issue
Block a user