Implements some micro-optimizations
All checks were successful
Build / Build (push) Successful in 51s

This commit is contained in:
2025-07-05 15:46:32 +02:00
parent c795f20e54
commit 8a857ed232
11 changed files with 80 additions and 21 deletions

View File

@@ -6,7 +6,7 @@ namespace PkmnLib.Static;
/// <summary>
/// A number that identifies a type. To be used with <see cref="TypeLibrary"/>
/// </summary>
public readonly record struct TypeIdentifier
public readonly struct TypeIdentifier : IEquatable<TypeIdentifier>
{
/// <summary>
/// The name of the type identifier.
@@ -27,4 +27,13 @@ public readonly record struct TypeIdentifier
/// <inheritdoc />
public override int GetHashCode() => Value.GetHashCode();
/// <inheritdoc />
public bool Equals(TypeIdentifier other) => Value == other.Value;
/// <inheritdoc />
public override bool Equals(object? obj) => obj is TypeIdentifier other && Equals(other);
public static bool operator ==(TypeIdentifier left, TypeIdentifier right) => left.Equals(right);
public static bool operator !=(TypeIdentifier left, TypeIdentifier right) => !left.Equals(right);
}