PkmnLib.NET/PkmnLib.Static/TypeIdentifier.cs

28 lines
703 B
C#
Raw Normal View History

2024-07-20 14:12:39 +00:00
using PkmnLib.Static.Libraries;
2024-07-20 11:51:52 +00:00
namespace PkmnLib.Static;
2024-07-20 14:12:39 +00:00
/// <summary>
/// A number that identifies a type. To be used with <see cref="TypeLibrary"/>
/// </summary>
2024-07-20 11:51:52 +00:00
public readonly record struct TypeIdentifier
{
2024-07-20 14:12:39 +00:00
/// <summary>
/// The underlying value of the type identifier.
/// </summary>
public byte Value { get; }
/// <inheritdoc cref="TypeIdentifier"/>
2024-07-20 11:51:52 +00:00
public TypeIdentifier(byte value)
{
Value = value;
}
2024-07-20 14:12:39 +00:00
/// <summary>
/// Converts a byte to a type identifier.
/// </summary>
2024-07-20 11:51:52 +00:00
public static implicit operator TypeIdentifier(byte value) => new(value);
2024-07-20 14:12:39 +00:00
/// <inheritdoc />
2024-07-20 11:51:52 +00:00
public override int GetHashCode() => Value.GetHashCode();
}