Skip to content

Commit c415d1a

Browse files
Revised "AddThese" to just "Add"
1 parent 499a2cd commit c415d1a

7 files changed

Lines changed: 17 additions & 14 deletions

File tree

source/CollectionWrapper.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,8 @@ protected virtual void AddInternal(T item)
3232
[MethodImpl(MethodImplOptions.AggressiveInlining)]
3333
public virtual void Add(T item) => AddInternal(item);
3434

35-
/// <inheritdoc cref="IAddMultiple{T}.AddThese(T, T, T[])"/>
36-
public virtual void AddThese(T item1, T item2, params T[] items)
35+
/// <inheritdoc cref="IAddMultiple{T}.Add(T, T, T[])"/>
36+
public virtual void Add(T item1, T item2, params T[] items)
3737
{
3838
AddInternal(item1);
3939
AddInternal(item2);

source/IAddMultiple.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ public interface IAddMultiple<T>
77
/// <param name="item1">First item to add.</param>
88
/// <param name="item2">Additional item to add.</param>
99
/// <param name="items">Extended param items to add.</param>
10-
void AddThese(T item1, T item2, params T[] items);
10+
void Add(T item1, T item2, params T[] items);
1111

1212
/// <summary>
1313
/// Adds all the items in <paramref name="items"/> to this collection.

source/ReadOnlyCollectionWrapper.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,6 @@ public virtual Span<T> CopyTo(Span<T> span)
7070
=> InternalSource.CopyToSpan(span);
7171

7272
/// <inheritdoc cref="ISynchronizedCollection&lt;T&gt;.Export(ICollection{T})" />
73-
7473
[ExcludeFromCodeCoverage]
7574
[MethodImpl(MethodImplOptions.AggressiveInlining)]
7675
public virtual void Export(ICollection<T> to)

source/Synchronized/LockSynchronizedCollectionWrapper.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ public override void Add(T item)
2323

2424
/// <inheritdoc />
2525
[SuppressMessage("Roslynator", "RCS1235:Optimize method call.")]
26-
public override void AddThese(T item1, T item2, params T[] items)
26+
public override void Add(T item1, T item2, params T[] items)
2727
{
2828
lock (Sync)
2929
{

source/Synchronized/ReadWriteSynchronizedCollectionWrapper.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ public override void Add(T item)
3232

3333
/// <inheritdoc />
3434
[SuppressMessage("Roslynator", "RCS1235:Optimize method call.")]
35-
public override void AddThese(T item1, T item2, params T[] items)
35+
public override void Add(T item1, T item2, params T[] items)
3636
{
3737
using var write = RWLock.WriteLock();
3838
base.Add(item1);

source/Synchronized/TrackedCollectionWrapper.cs

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
using System.Collections.Immutable;
66
using System.Diagnostics.CodeAnalysis;
77
using System.Linq;
8+
using System.Runtime.CompilerServices;
89
using System.Threading;
910

1011
namespace Open.Collections.Synchronized;
@@ -37,6 +38,9 @@ protected override void OnDispose()
3738
Nullify(ref InternalSource); // Eliminate risk from wrapper.
3839
}
3940

41+
[MethodImpl(MethodImplOptions.AggressiveInlining)]
42+
private bool AssertIsAliveCore() => AssertIsAlive();
43+
4044
/// <inheritdoc />
4145
public int Count
4246
=> Sync!.Reading(() =>
@@ -51,15 +55,15 @@ protected virtual void AddInternal(T item)
5155

5256
/// <inheritdoc />
5357
public void Add(T item)
54-
=> Sync!.Modifying(() => AssertIsAlive(), () =>
58+
=> Sync!.Modifying(AssertIsAliveCore, () =>
5559
{
5660
AddInternal(item);
5761
return true;
5862
});
5963

60-
/// <inheritdoc cref="IAddMultiple{T}.AddThese(T, T, T[])" />
61-
public void AddThese(T item1, T item2, params T[] items)
62-
=> Sync!.Modifying(() => AssertIsAlive(), () =>
64+
/// <inheritdoc cref="IAddMultiple{T}.Add(T, T, T[])" />
65+
public void Add(T item1, T item2, params T[] items)
66+
=> Sync!.Modifying(AssertIsAliveCore, () =>
6367
{
6468
AddInternal(item1);
6569
AddInternal(item2);
@@ -83,7 +87,7 @@ public void AddRange(IEnumerable<T> items)
8387
if (enumerable.Count == 0)
8488
return;
8589

86-
Sync!.Modifying(() => AssertIsAlive(), () =>
90+
Sync!.Modifying(AssertIsAliveCore, () =>
8791
{
8892
foreach (var item in enumerable)
8993
AddInternal(item);
@@ -122,7 +126,7 @@ public void CopyTo(T[] array, int arrayIndex)
122126
/// <inheritdoc />
123127
public virtual bool Remove(T item)
124128
=> Sync!.Modifying(
125-
() => AssertIsAlive(),
129+
AssertIsAliveCore,
126130
() => InternalSource.Remove(item));
127131

128132
[ExcludeFromCodeCoverage]

testing/Open.Collections.Tests/BasicCollectionTests.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,12 +33,12 @@ public void AddThese()
3333
if (Collection is not IAddMultiple<int> c) return;
3434
if (Collection.IsReadOnly)
3535
{
36-
Assert.Throws<Exception>(() => c.AddThese(1, 2, 3, 4));
36+
Assert.Throws<Exception>(() => c.Add(1, 2, 3, 4));
3737
return;
3838
}
3939

4040
int count = Collection.Count;
41-
c.AddThese(1, 2, 3, 4);
41+
c.Add(1, 2, 3, 4);
4242
Collection.Count.Should().Be(count + 4);
4343
}
4444

0 commit comments

Comments
 (0)