Verified Commit 4701f937 authored by LeoFun01's avatar LeoFun01

Add `Inverse` extension method for `ISet<T>`.

parent 55429a1e
...@@ -12,6 +12,11 @@ private sealed class InternalSet<T> : ISet<T> ...@@ -12,6 +12,11 @@ private sealed class InternalSet<T> : ISet<T>
public bool Contains(T item) { return _contains(item); } public bool Contains(T item) { return _contains(item); }
} }
public static ISet<T> Inverse<T>(this ISet<T> _this)
where T : IEquatable<T>
{
return new InternalSet<T>(e => !_this.Contains(e));
}
public static ISet<T> Union<T>(this ISet<T> _this, ISet<T> other) public static ISet<T> Union<T>(this ISet<T> _this, ISet<T> other)
where T : IEquatable<T> where T : IEquatable<T>
{ {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment