-
Notifications
You must be signed in to change notification settings - Fork 20
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Union] attribute on an partial record
instead of interface
?
#17
Comments
abstract record
instead of interface
?partial record
instead of interface
?
I really like this idea! Seems more powerful and easier to generate sources for. Implementation note If this method proves better, we can eventually deprecate the marked interface generator in favor of this new method. |
With this implementation we should also be able to do: using static Result;
// Instantiate the Error case directly:
var result = new Error(new Exception("hi :)"));
// Use the factory methods that return `Result`:
var otherResult = NewError(new Exception("another way")); |
Closing as the core functionality is implemented by #21 and #25 and released in https://github.com/domn1995/dunet/releases/tag/v0.5.0 Will track factory method generation in #12. Thanks so much for this awesome suggestion! |
Example usage
Benefits
Result
as it has a private constructor.Result
class and the case classes directly rather than having to write them as extension methods.Match
method, as opposed to the extension method that you have currently.Source generator produces
The text was updated successfully, but these errors were encountered: