示例#1
0
 /// <summary>
 /// Determines if this bag is a proper subset of another bag. Neither bag is modified.
 /// This bag is a subset of <paramref name="otherBag"/> if every element in this bag
 /// is also in <paramref name="otherBag"/>, at least the same number of
 /// times. Additional, this bag must have strictly fewer items than <paramref name="otherBag"/>.
 /// </summary>
 /// <remarks>IsProperSubsetOf is computed in time O(N), where N is the number of unique items in this bag.</remarks>
 /// <param name="otherBag">Bag to compare to.</param>
 /// <returns>True if this is a proper subset of <paramref name="otherBag"/>.</returns>
 /// <exception cref="InvalidOperationException">This bag and <paramref name="otherBag"/> don't use the same method for comparing items.</exception>
 public bool IsProperSubsetOf(Bag <T> otherBag)
 {
     return(otherBag.IsProperSupersetOf(this));
 }