/// <inheritdoc/> public IImmutableSet <T> Clear() { if (object.ReferenceEquals(this.clearSet, ImmutableSetAdapter <T> .InitialClearSetValue)) { this.clearSet = new ImmutableSetAdapter <T>(this.Set.Clear()); } #pragma warning disable CS8603 // Possible null reference return. It isn't realizing we ensured it's non-null. return(this.clearSet); #pragma warning restore CS8603 // Possible null reference return. }
/// <summary> /// Initializes a new instance of the <see cref="ImmutableSetAdapter{T}"/> class. /// </summary> /// <param name="set"> /// The set to adapt. /// </param> public ImmutableSetAdapter(System.Collections.Immutable.IImmutableSet <T> set) { this.Set = set ?? throw new ArgumentNullException(nameof(set)); this.clearSet = ImmutableSetAdapter <T> .InitialClearSetValue; }