FruityFoundation/Base/Structures/NullableExtensions.cs

11 lines
285 B
C#
Raw Normal View History

2023-08-01 22:12:54 -04:00
namespace FruityFoundation.Base.Structures;
public static class NullableExtensions
{
public static Maybe<T> ToMaybe<T>(this T? item) where T : struct =>
item ?? Maybe.Empty<T>();
2023-12-24 21:11:25 -05:00
public static Maybe<T> AsMaybe<T>(this T? item) where T : class =>
item ?? Maybe.Empty<T>();
2023-08-01 22:12:54 -04:00
}