Created
February 23, 2020 19:57
-
-
Save TheFo2sh/121c208a6e1bb235df32e43d51b89c68 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static class OptionExtensions | |
{ | |
public static Option<(TOuterA, TOuterB, TInner)> Intersect<TOuterA, TOuterB, TInner>(this Option<(TOuterA, TOuterB)> outer, Option<TInner> inner) | |
{ | |
return outer.HasValue && inner.HasValue | |
? outer.Select(outer1 => (outer1.Item1,outer1.Item2, inner.ValueOrFailure())) | |
: Option.None<(TOuterA, TOuterB, TInner)>(); | |
} | |
public static Option<(TOuter,TInner)> Intersect<TOuter, TInner>(this Option<TOuter> outer,Option<TInner> inner) | |
{ | |
return outer.HasValue && inner.HasValue | |
? outer.Select(outer1 => (outer1, inner.ValueOrFailure())) | |
: Option.None<(TOuter, TInner)>(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment