Skip to content

Commit 3b5eff0

Browse files
Reformat and reference update.
1 parent 0558432 commit 3b5eff0

33 files changed

+220
-431
lines changed

benchmarking/Benchmarks/CollectionBenchmark.cs

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,7 @@ namespace Open.Collections
77
{
88
public class CollectionBenchmark<T> : BenchmarkBase<Func<ICollection<T>>>
99
{
10-
public CollectionBenchmark(uint size, uint repeat, Func<ICollection<T>> factory, Func<int, T> itemFactory) : base(size, repeat, factory)
11-
{
12-
_items = Enumerable.Range(0, (int)TestSize * 2).Select(itemFactory).ToArray();
13-
}
10+
public CollectionBenchmark(uint size, uint repeat, Func<ICollection<T>> factory, Func<int, T> itemFactory) : base(size, repeat, factory) => _items = Enumerable.Range(0, (int)TestSize * 2).Select(itemFactory).ToArray();
1411

1512
protected readonly T[] _items;
1613

@@ -85,17 +82,11 @@ public class CollectionBenchmark : CollectionBenchmark<object>
8582

8683
}
8784

88-
public static TimedResult[] Results<T>(uint size, uint repeat, Func<ICollection<T>> factory, Func<int, T> itemFactory)
89-
{
90-
return (new CollectionBenchmark<T>(size, repeat, factory, itemFactory)).Result;
91-
}
85+
public static TimedResult[] Results<T>(uint size, uint repeat, Func<ICollection<T>> factory, Func<int, T> itemFactory) => (new CollectionBenchmark<T>(size, repeat, factory, itemFactory)).Result;
9286

9387

9488
public static TimedResult[] Results<T>(uint size, uint repeat, Func<ICollection<T>> factory)
95-
where T : new()
96-
{
97-
return (new CollectionBenchmark<T>(size, repeat, factory, i => new T())).Result;
98-
}
89+
where T : new() => (new CollectionBenchmark<T>(size, repeat, factory, i => new T())).Result;
9990

10091
}
10192
}

benchmarking/Benchmarks/CollectionParallelBenchmark.cs

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -145,17 +145,11 @@ public class CollectionParallelBenchmark : CollectionParallelBenchmark<object>
145145

146146
}
147147

148-
public static TimedResult[] Results<T>(uint size, uint repeat, Func<ICollection<T>> factory, Func<int, T> itemFactory)
149-
{
150-
return (new CollectionParallelBenchmark<T>(size, repeat, factory, itemFactory)).Result;
151-
}
148+
public static TimedResult[] Results<T>(uint size, uint repeat, Func<ICollection<T>> factory, Func<int, T> itemFactory) => (new CollectionParallelBenchmark<T>(size, repeat, factory, itemFactory)).Result;
152149

153150

154151
public static TimedResult[] Results<T>(uint size, uint repeat, Func<ICollection<T>> factory)
155-
where T : new()
156-
{
157-
return (new CollectionParallelBenchmark<T>(size, repeat, factory, i => new T())).Result;
158-
}
152+
where T : new() => (new CollectionParallelBenchmark<T>(size, repeat, factory, i => new T())).Result;
159153

160154
}
161155

benchmarking/Benchmarks/DictionaryParallelBenchmark.cs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,6 @@ protected override IEnumerable<TimedResult> TestOnceInternal()
4646
});
4747
}
4848

49-
public static TimedResult[] Results(uint size, uint repeat, Func<IDictionary<int, object>> factory)
50-
{
51-
return (new DictionaryParallelBenchmark(size, repeat, factory)).Result;
52-
}
49+
public static TimedResult[] Results(uint size, uint repeat, Func<IDictionary<int, object>> factory) => (new DictionaryParallelBenchmark(size, repeat, factory)).Result;
5350
}
5451
}

benchmarking/Benchmarks/LinkedListBenchmark.cs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -46,10 +46,7 @@ protected override IEnumerable<TimedResult> TestOnceInternal()
4646

4747
}
4848

49-
public static TimedResult[] Results(uint size, uint repeat, Func<ILinkedList<object>> factory)
50-
{
51-
return (new LinkedListBenchmark(size, repeat, factory)).Result;
52-
}
49+
public static TimedResult[] Results(uint size, uint repeat, Func<ILinkedList<object>> factory) => (new LinkedListBenchmark(size, repeat, factory)).Result;
5350

5451
}
5552
}

benchmarking/Benchmarks/LinkedListParallelBenchmark.cs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -53,10 +53,7 @@ protected override IEnumerable<TimedResult> TestOnceInternal()
5353

5454
}
5555

56-
public new static TimedResult[] Results(uint size, uint repeat, Func<ILinkedList<object>> factory)
57-
{
58-
return (new LinkedListParallelBenchmark(size, repeat, factory)).Result;
59-
}
56+
public new static TimedResult[] Results(uint size, uint repeat, Func<ILinkedList<object>> factory) => (new LinkedListParallelBenchmark(size, repeat, factory)).Result;
6057

6158
}
6259
}

benchmarking/Benchmarks/ListParallelBenchmark.cs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,6 @@ public ListParallelBenchmark(uint size, uint repeat, Func<IList<object>> factory
4343
// });
4444
//}
4545

46-
public static TimedResult[] Results(uint size, uint repeat, Func<IList<object>> factory)
47-
{
48-
return (new ListParallelBenchmark(size, repeat, factory)).Result;
49-
}
46+
public static TimedResult[] Results(uint size, uint repeat, Func<IList<object>> factory) => (new ListParallelBenchmark(size, repeat, factory)).Result;
5047
}
5148
}

benchmarking/Benchmarks/QueueBenchmark.cs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,7 @@ protected override IEnumerable<TimedResult> TestOnceInternal()
2929

3030
}
3131

32-
public static TimedResult[] Results(uint size, uint repeat, Func<IQueue<object>> queueFactory)
33-
{
34-
return (new QueueBenchmark(size, repeat, queueFactory)).Result;
35-
}
32+
public static TimedResult[] Results(uint size, uint repeat, Func<IQueue<object>> queueFactory) => (new QueueBenchmark(size, repeat, queueFactory)).Result;
3633

3734
}
3835
}

benchmarking/Benchmarks/QueueParallelBenchmark.cs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,10 +40,7 @@ protected override IEnumerable<TimedResult> TestOnceInternal()
4040

4141
}
4242

43-
public new static TimedResult[] Results(uint size, uint repeat, Func<IQueue<object>> factory)
44-
{
45-
return (new QueueParallelBenchmark(size, repeat, factory)).Result;
46-
}
43+
public new static TimedResult[] Results(uint size, uint repeat, Func<IQueue<object>> factory) => (new QueueParallelBenchmark(size, repeat, factory)).Result;
4744

4845
}
4946
}

source/CollectionWrapper.cs

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,7 @@ protected CollectionWrapper(TCollection source) : base(source)
1212
#region Implementation of ICollection<T>
1313

1414
/// <inheritdoc />
15-
public virtual void Add(T item)
16-
=> InternalSource.Add(item);
15+
public virtual void Add(T item) => InternalSource.Add(item);
1716

1817
/// <inheritdoc cref="ICollection&lt;T&gt;" />
1918
/// <param name="item1">First item to add.</param>
@@ -41,12 +40,10 @@ public virtual void Add(T[] items)
4140
}
4241

4342
/// <inheritdoc />
44-
public virtual void Clear()
45-
=> InternalSource.Clear();
43+
public virtual void Clear() => InternalSource.Clear();
4644

4745
/// <inheritdoc />
48-
public virtual bool Remove(T item)
49-
=> InternalSource.Remove(item);
46+
public virtual bool Remove(T item) => InternalSource.Remove(item);
5047

5148
/// <inheritdoc />
5249
public override bool IsReadOnly

source/ConcurrentHashSet.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ public class ConcurrentHashSet<T> : DictionaryToHashSetWrapper<T>
88
public ConcurrentHashSet(IEnumerable<T>? intialValues = null)
99
: base(new ConcurrentDictionary<T, bool>())
1010
{
11-
if (intialValues != null)
11+
if (intialValues is not null)
1212
UnionWith(intialValues);
1313
}
1414
}

0 commit comments

Comments
 (0)