2023-06-05 19:57:17 +08:00
|
|
|
using System;
|
2023-06-29 14:57:11 +08:00
|
|
|
|
2023-06-05 19:57:17 +08:00
|
|
|
namespace BITKit
|
|
|
|
{
|
|
|
|
public static partial class Extensions
|
|
|
|
{
|
|
|
|
public static T IsNull<T>(this T t, Action action)
|
|
|
|
{
|
|
|
|
if (t is null)
|
|
|
|
{
|
|
|
|
action.Invoke();
|
|
|
|
}
|
|
|
|
return t;
|
|
|
|
}
|
|
|
|
public static T IsNotNull<T>(this T t, Action<T> action)
|
|
|
|
{
|
|
|
|
if (t is not null)
|
|
|
|
{
|
|
|
|
action.Invoke(t);
|
|
|
|
}
|
|
|
|
return t;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|