brutal/brutal.core/Brutal.Core/Interfaces/INullable.cs
2026-10-15 14:12:02 +13:00

27 lines
545 B
C#

namespace Brutal;
/// <summary>
/// Interface for a type that can be null
/// </summary>
public interface INullable
{
/// <summary>
/// Returns true if the instance is null
/// </summary>
public bool IsNull();
}
/// <summary>
/// Extensions for INullable
/// </summary>
public static class NullableExtensions
{
/// <summary>
/// Returns true if the instance is not null
/// </summary>
public static bool IsNotNull<T>(this T nullable)
where T : INullable
{
return !nullable.IsNull();
}
}