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.BooleanTryParse(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=newTenantId(__v);returntrue;}result=DefaultValue;// instead of `= default`;returnfalse;}}
The text was updated successfully, but these errors were encountered:
Yea, I believe something like this is already used as a workaround by me, but it will be appreciated if there will be a default value behavior. Could be especially interesting for strings
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: