You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In my real life scenarios I have a concept of DefaultValue - it's mostly used in my custom TryParse scenarios, when the parsing failed, but the value still needs to be valid an initialized with something meaningful.
A possible implementation would be to have a static property DefaultValue, this way we also should be able to use with Static Abstract Members if needed for custom solutions.
The only note I have, since not every type has a default value, it would make sense to have a separate interface IVogenHasDefaultValue<>
[ValueObject<byte>][Instance("None","0")]publicreadonlypartialrecordstructTenantId{// Either manually or via Instance//public static readonly byte None = From(0);publicstaticbyteDefaultValue=> None;// ...// Generated Codepublicstaticglobal::System.Boolean TryParse(global::System.ReadOnlySpan<byte>utf8Text,
#if NETCOREAPP3_0_OR_GREATER
[global::System.Diagnostics.CodeAnalysis.NotNullWhen(true)]
#endif
outTenantIdresult){if(System.Byte.TryParse(utf8Text,outvar __v)){result=new TenantId(__v);returntrue;}result=DefaultValue;// instead of `= default`;returnfalse;}}
The text was updated successfully, but these errors were encountered:
Describe the feature
In my real life scenarios I have a concept of DefaultValue - it's mostly used in my custom TryParse scenarios, when the parsing failed, but the value still needs to be valid an initialized with something meaningful.
A possible implementation would be to have a static property
DefaultValue
, this way we also should be able to use with Static Abstract Members if needed for custom solutions.The only note I have, since not every type has a default value, it would make sense to have a separate interface
IVogenHasDefaultValue<>
The text was updated successfully, but these errors were encountered: