DigitecGalaxus / Galaxus.Functional

A package bringing popular functional abstractions (e.g. Option or Result) to C#.
Other
37 stars 12 forks source link

Add Option.MapOrElse #39

Closed nightruby-isa closed 1 year ago

nightruby-isa commented 1 year ago

Would love to have support for MapOrElse on Option to simplify option.Map(v => new Obj(v)).UnwrapOrElse(() => new Obj(fallback))

phkiener commented 1 year ago

Yeah, that's a legitimate shortcut. We got Option.MapOr, so Option.MapOrElse fits nicely - thanks alot!