Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches

◆ Remove()

bool System.Collections.Generic.HashSet< T >.Remove ( T item)
inline

Implements System.Collections.Generic.ICollection< T >.

Definition at line 327 of file HashSet.cs.

328 {
329 if (_buckets != null)
330 {
332 uint num = 0u;
333 int num2 = -1;
334 int num3 = ((item != null) ? (_comparer?.GetHashCode(item) ?? item.GetHashCode()) : 0);
336 int num4 = bucketRef - 1;
337 while (num4 >= 0)
338 {
340 if (reference.HashCode == num3 && (_comparer?.Equals(reference.Value, item) ?? EqualityComparer<T>.Default.Equals(reference.Value, item)))
341 {
342 if (num2 < 0)
343 {
345 }
346 else
347 {
348 entries[num2].Next = reference.Next;
349 }
351 if (RuntimeHelpers.IsReferenceOrContainsReferences<T>())
352 {
353 reference.Value = default(T);
354 }
355 _freeList = num4;
356 _freeCount++;
357 return true;
358 }
359 num2 = num4;
360 num4 = reference.Next;
361 num++;
362 if (num > (uint)entries.Length)
363 {
364 ThrowHelper.ThrowInvalidOperationException_ConcurrentOperationsNotSupported();
365 }
366 }
367 }
368 return false;
369 }
IEqualityComparer< T > _comparer
Definition HashSet.cs:105
ref int GetBucketRef(int hashCode)
Definition HashSet.cs:321

References System.Collections.Generic.HashSet< T >._buckets, System.Collections.Generic.HashSet< T >._comparer, System.Collections.Generic.HashSet< T >._entries, System.Collections.Generic.HashSet< T >._freeCount, System.Collections.Generic.HashSet< T >._freeList, System.Runtime.Serialization.Dictionary, System.Collections.Generic.IEqualityComparer< in T >.Equals(), System.Collections.Generic.HashSet< T >.GetBucketRef(), System.Collections.Generic.IEqualityComparer< in T >.GetHashCode(), System.item, and System.ThrowHelper.ThrowInvalidOperationException_ConcurrentOperationsNotSupported().

Referenced by System.Collections.Generic.HashSet< T >.ExceptWith(), System.Collections.Generic.HashSet< T >.IntersectWithEnumerable(), System.Collections.Generic.HashSet< T >.IntersectWithHashSetWithSameComparer(), System.Linq.Parallel.IntersectQueryOperator< TInputOutput >.IntersectQueryOperatorEnumerator< TLeftKey >.MoveNext(), Terraria.WorldBuilding.ShapeData.Remove(), System.Collections.Generic.HashSet< T >.RemoveWhere(), System.Collections.Generic.HashSet< T >.SymmetricExceptWithEnumerable(), and System.Collections.Generic.HashSet< T >.SymmetricExceptWithUniqueHashSet().