FruityFoundation/Base/Extensions/FSharpExtensions.cs

12 lines
320 B
C#
Raw Normal View History

2022-02-24 19:11:28 -05:00
using FruityFoundation.Base.Structures;
2021-11-19 00:12:02 -05:00
using Microsoft.FSharp.Core;
2022-02-24 19:11:28 -05:00
namespace FruityFoundation.Base.Extensions;
2021-11-19 00:12:02 -05:00
public static class FSharpExtensions
{
public static Maybe<T> ToMaybe<T>(this FSharpOption<T> option) =>
FSharpOption<T>.get_IsSome(option)
? Maybe<T>.Create(option.Value)
: Maybe<T>.Empty();
}