/// <summary> /// Adds the specified item. May overwrite an existing item. /// </summary> /// <param name="item">The item.</param> /// <returns>Returns the position where the item was added.</returns> public int Add(T item) { var index = Interlocked.Increment(ref _index) & (Capacity - 1); _entries.SetInternal(index, item, out _); return(index); }
/// <summary> /// Adds the specified item. May overwrite an existing item. /// </summary> /// <param name="item">The item.</param> /// <returns>Returns the position where the item was added.</returns> public int Add(T item) { var index = Interlocked.Increment(ref _index) & (_capacity - 1); bool isNew; _entries.SetInternal(index, item, out isNew); return(index); }