同步基础框架

master
smartwyy 6 months ago
parent 061a77b52e
commit 78111aff20

@ -0,0 +1,71 @@
namespace HybirdFrameworkCore.Utils;
/// <summary>
///
/// </summary>
public static class ObjUtils
{
/// <summary>
///
/// </summary>
/// <param name="o"></param>
/// <returns></returns>
public static bool IsNull(object? o)
{
return o == null;
}
/// <summary>
///
/// </summary>
/// <param name="o"></param>
/// <returns></returns>
public static bool IsNotNull(object? o)
{
return o != null;
}
/// <summary>
///
/// </summary>
/// <param name="list"></param>
/// <typeparam name="T"></typeparam>
/// <returns></returns>
public static bool IsEmpty<T>(List<T>? list)
{
return list == null || list.Count == 0;
}
/// <summary>
///
/// </summary>
/// <param name="list"></param>
/// <typeparam name="T"></typeparam>
/// <returns></returns>
public static bool IsNotEmpty<T>(List<T>? list)
{
return list is { Count: >= 0 };
}
/// <summary>
///
/// </summary>
/// <param name="o"></param>
/// <returns></returns>
public static bool IsNullOrWhiteSpace(string? o)
{
return string.IsNullOrWhiteSpace(o);
}
/// <summary>
///
/// </summary>
/// <param name="o"></param>
/// <returns></returns>
public static bool IsNotNullOrWhiteSpace(string? o)
{
return !string.IsNullOrWhiteSpace(o);
}
public static readonly List<object> EmptyList = new List<object>(0);
}
Loading…
Cancel
Save