FruityFoundation/Base/Extensions/NullableExtensions.cs

12 lines
336 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
2022-02-24 19:11:28 -05:00
namespace FruityFoundation.Base.Extensions;
2021-11-19 00:12:02 -05:00
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();
}