-
Couldn't load subscription status.
- Fork 22
Description
I found this source generator very powerful and I love it, but there is some missing functionality about globalization:
- IParsable<TSelf> implementation is missing, and the exposed
Parse/TryParsemethod do not accept anIFormatProviderparameter:
// UnitGenerateOptions.ParseMethod
public static SomeInteger Parse(string s)
{
return new SomeInteger(int.Parse(s));
}
public static bool TryParse(string s, out SomeInteger result)
{
if (int.TryParse(s, out var r))
{
result = new SomeInteger(r);
return true;
}
else
{
result = default(SomeInteger);
return false;
}
}
- IFormattable implementation also is missing, with similar drawbacks:
public override string ToString() => value.ToString();
I guess both implementations requires checking the underlying type to ensure that it supports those interfaces and, in that case, implement and pass-through the aforementioned IFormatProvider.
Could be sweet to also expose ToString(string format) methods when available on the underlying type, but without a system interface flagging it, i admit is a bit tricky.
Side note: even i'm developing on C# from 10+ years this is my actual first github interaction, and -if you are OK with it- I do wish to contribute about this issue.