namespace Long.Core.Extensions; public static class CollectionExtensions { public static bool IsNullOrEmpty(this ICollection source) { if (source != null) { return source.Count <= 0; } return true; } public static bool AddIfNotContains(this ICollection source, T item) { if (source == null) { throw new ArgumentNullException("source"); } if (source.Contains(item)) { return false; } source.Add(item); return true; } }