FruityFoundation/Base/Extensions/NullableExtensions.cs

12 lines
324 B
C#
Raw Normal View History

2021-11-19 00:12:02 -05:00
using CommonCore.Base.Structures;
namespace CommonCore.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();
}