PKHeX/PKHeX.Core/Legality/Structures/CheckResult.cs
Kurt 907ed0b32f struct CheckResult
tiny object, eliminate allocation for them since they're 10-16 bytes at most.
2023-04-23 16:04:04 -07:00

16 lines
644 B
C#

namespace PKHeX.Core;
/// <summary>
/// Result of a Legality Check
/// </summary>
[System.Diagnostics.DebuggerDisplay($"{{{nameof(Identifier)}}}: {{{nameof(Comment)}}}")]
// ReSharper disable once NotAccessedPositionalProperty.Global
public readonly record struct CheckResult(Severity Judgement, CheckIdentifier Identifier, string Comment)
{
public bool Valid => Judgement != Severity.Invalid;
public string Rating => Judgement.Description();
internal CheckResult(CheckIdentifier i) : this(Severity.Valid, i, LegalityCheckStrings.L_AValid) { }
public string Format(string format) => string.Format(format, Rating, Comment);
}