FruityFoundation/Base/Extensions/NullableExtensions.cs
2022-02-24 19:25:28 -05:00

12 lines
336 B
C#

using FruityFoundation.Base.Structures;
namespace FruityFoundation.Base.Extensions;
public static class NullableExtensions
{
public static Maybe<T> ToMaybe<T>(this T? item) where T : struct =>
item ?? Maybe<T>.Empty();
public static Maybe<T> ToMaybe<T>(this T? item) where T : class =>
item ?? Maybe<T>.Empty();
}