Skip to content
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

add Filter method which returns exception based on the unmatched value #74

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from

Conversation

OlegKleyman
Copy link

This PR is to resolve issue #69

It adds a new Filter method to the Option<T, TException> class. The method is public Option<T, TException> Filter(Func<T, bool> predicate, Func<T, TException> exceptionFactory) and its goal is to allow the propagation of the unmatched value to the exception factory Func thus allowing the value in the optional to be used to create the exception when filtering fails to match.

I appreciate your time in taking a look at this PR.

@Clindbergh
Copy link

I think a 2nd method public Option<T> Filter(Func<T, bool> predicate) that empties the Option without producing an exception would be a useful addition.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants