R# cleanup

This commit is contained in:
JustArchi
2018-12-15 00:27:15 +01:00
parent 39fb21cc83
commit f8aa8babcf
48 changed files with 1510 additions and 32 deletions

View File

@@ -54,26 +54,31 @@ namespace ArchiSteamFarm.Collections {
public bool IsProperSubsetOf(IEnumerable<T> other) {
ISet<T> otherSet = other as ISet<T> ?? other.ToHashSet();
return (otherSet.Count > Count) && IsSubsetOf(otherSet);
}
public bool IsProperSupersetOf(IEnumerable<T> other) {
ISet<T> otherSet = other as ISet<T> ?? other.ToHashSet();
return (otherSet.Count < Count) && IsSupersetOf(otherSet);
}
public bool IsSubsetOf(IEnumerable<T> other) {
ISet<T> otherSet = other as ISet<T> ?? other.ToHashSet();
return this.All(otherSet.Contains);
}
public bool IsSupersetOf(IEnumerable<T> other) {
ISet<T> otherSet = other as ISet<T> ?? other.ToHashSet();
return otherSet.All(Contains);
}
public bool Overlaps(IEnumerable<T> other) {
ISet<T> otherSet = other as ISet<T> ?? other.ToHashSet();
return otherSet.Any(Contains);
}
@@ -81,13 +86,14 @@ namespace ArchiSteamFarm.Collections {
public bool SetEquals(IEnumerable<T> other) {
ISet<T> otherSet = other as ISet<T> ?? other.ToHashSet();
return (otherSet.Count == Count) && otherSet.All(Contains);
}
public void SymmetricExceptWith(IEnumerable<T> other) {
ISet<T> otherSet = other as ISet<T> ?? other.ToHashSet();
HashSet<T> removed = new HashSet<T>();
foreach (T item in otherSet.Where(Contains)) {
removed.Add(item);
Remove(item);
@@ -119,6 +125,7 @@ namespace ArchiSteamFarm.Collections {
}
ReplaceWith(other);
return true;
}