/// <summary>Determines whether the current set is a superset of a specified collection.</summary> /// <param name="source">The current set.</param> /// <param name="other">The collection to compare to the current set.</param> /// <returns><see langword="true"/> if the current set is a superset of the specified collection; otherwise, <see langword="false" />.</returns> public static bool IsSupersetOf(this IModels source, IModels other) { source.VerifyNotNull(nameof(source)); other.VerifyNotNull(nameof(other)); return(source.Count >= other.Count ? source.ContainsAll(other) : false); }
/// <summary>Determines whether the current set and the specified collection contain the same elements.</summary> /// <param name="source">The current set.</param> /// <param name="other">The collection to compare to the current set.</param> /// <returns><see langword="true"/> if the current set and the specified collection contain the same elements; otherwise, <see langword="false" />.</returns> public static bool SetEquals(this IModels source, IModels other) { source.VerifyNotNull(nameof(source)); other.VerifyNotNull(nameof(other)); return(source.Count == other.Count ? source.ContainsAll(other) : false); }
/// <summary>Determines whether the current set is a proper (strict) subset of the specified collection.</summary> /// <param name="source">The current set.</param> /// <param name="other">The collection to compare to the current set.</param> /// <returns><see langword="true"/> if the current set is a proper subset of the specified collection; otherwise, <see langword="false" />.</returns> public static bool IsProperSubsetOf(this IModels source, IModels other) { source.VerifyNotNull(nameof(source)); other.VerifyNotNull(nameof(other)); return(source.Count < other.Count ? other.ContainsAll(source) : false); }