-
-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
ad86a8c
commit f8556dd
Showing
6 changed files
with
58 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
**API count: 400** | ||
**API count: 401** |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
// <auto-generated /> | ||
#pragma warning disable | ||
|
||
#if NETFRAMEWORK || NETSTANDARD2_0 | ||
|
||
namespace Polyfills; | ||
|
||
using System; | ||
using System.Collections.Concurrent; | ||
using Link = System.ComponentModel.DescriptionAttribute; | ||
|
||
static partial class Polyfill | ||
{ | ||
/// <summary> | ||
/// Removes all values from the <see cref="ConcurrentBag{T}"/>. | ||
/// </summary> | ||
[Link("https://learn.microsoft.com/en-us/dotnet/api/system.collections.concurrent.concurrentbag-1.clear")] | ||
public static void Clear<T>(this ConcurrentBag<T> target) | ||
{ | ||
if (target is null) | ||
{ | ||
throw new ArgumentNullException(nameof(target)); | ||
} | ||
|
||
while (!target.IsEmpty) | ||
{ | ||
target.TryTake(out _); | ||
} | ||
} | ||
} | ||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
partial class PolyfillTests | ||
{ | ||
[Test] | ||
public void ConcurrentBagClear() | ||
{ | ||
var bag = new ConcurrentBag<string> | ||
{ | ||
"Hello" | ||
}; | ||
bag.Clear(); | ||
Assert.AreEqual(0, bag.Count); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters