mirror of
https://github.com/bitwarden/server.git
synced 2025-07-02 00:22:50 -05:00
Remove Batch (#2274)
This commit is contained in:
@ -70,32 +70,6 @@ public static class CoreHelpers
|
||||
return new Guid(guidArray);
|
||||
}
|
||||
|
||||
public static IEnumerable<IEnumerable<T>> Batch<T>(this IEnumerable<T> source, int size)
|
||||
{
|
||||
T[] bucket = null;
|
||||
var count = 0;
|
||||
foreach (var item in source)
|
||||
{
|
||||
if (bucket == null)
|
||||
{
|
||||
bucket = new T[size];
|
||||
}
|
||||
bucket[count++] = item;
|
||||
if (count != size)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
yield return bucket.Select(x => x);
|
||||
bucket = null;
|
||||
count = 0;
|
||||
}
|
||||
// Return the last bucket with all remaining elements
|
||||
if (bucket != null && count > 0)
|
||||
{
|
||||
yield return bucket.Take(count);
|
||||
}
|
||||
}
|
||||
|
||||
public static string CleanCertificateThumbprint(string thumbprint)
|
||||
{
|
||||
// Clean possible garbage characters from thumbprint copy/paste
|
||||
|
Reference in New Issue
Block a user