Schema.NET
Schema.NET copied to clipboard
Consider Implementing `IParseable` in .NET 6
Describe the feature
See https://devblogs.microsoft.com/dotnet/preview-features-in-net-6-generic-math/#static-abstracts-in-interfaces
public interface IParseable<TSelf>
where TSelf : IParseable<TSelf>
{
static abstract TSelf Parse(string s, IFormatProvider? provider);
static abstract bool TryParse([NotNullWhen(true)] string? s, IFormatProvider? provider, out TSelf result);
}
Interesting - you thinking have this on Thing
or maybe each of our derived types implements it? Should mostly be able to pass it off to the SchemaSerializer
class.
I was thinking it would be nice to have it on Thing
as just a convenience method.
If we can't make use of #310 (source generators from S.T.J), we could even use these methods to output custom serialization for a type from our own source generator. That is to say, we'd generate it ourselves when we generate the model.