using System.Net; using Bunny.Common.Exception; namespace Bunny.Common.Utils; public class EmptyUtil { /// /// 判断对象或者字符串是否为空 /// /// 传入的对象 /// 出错的状态码 /// 出错的消息 public static void CheckIfNullOrEmpty(object? obj, HttpStatusCode code, string message) { if (obj == null || (obj is string s && string.IsNullOrEmpty(s))) throw new BunnyException(code, message); } }