mirror of
https://github.com/kwsch/PKHeX.git
synced 2026-03-21 17:48:28 -05:00
Did something similar for NHSE years ago. Allows for much easier reuse elsewhere and clearer usage.
19 lines
763 B
C#
19 lines
763 B
C#
using System.Diagnostics.CodeAnalysis;
|
|
|
|
namespace PKHeX.Core;
|
|
|
|
/// <summary>
|
|
/// Interface for retrieving properties from a <see cref="T"/>.
|
|
/// </summary>
|
|
public interface IPropertyProvider<in T> where T : notnull
|
|
{
|
|
/// <summary>
|
|
/// Attempts to retrieve a property's value (as string) from an entity instance.
|
|
/// </summary>
|
|
/// <param name="obj">Entity to retrieve the property from.</param>
|
|
/// <param name="prop">Property name to retrieve.</param>
|
|
/// <param name="result">Property value as string.</param>
|
|
/// <returns><see langword="true"/> if the property was found and retrieved successfully; otherwise, <see langword="false"/>.</returns>
|
|
bool TryGetProperty(T obj, string prop, [NotNullWhen(true)] out string? result);
|
|
}
|