fix: Fixes GetAllSharedAccounts and other list conversions in AdminGump (#1422)

---------

Co-authored-by: Kamron Batman <3953314+kamronbatman@users.noreply.github.com>
This commit is contained in:
Mink80 2023-07-09 00:20:00 +02:00 • committed by GitHub
parent 27e00cc73f
commit 3825b16132
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 100 additions and 110 deletions

View file

@ -806,6 +806,27 @@ public static class Utility
return outputList;
}
// ToArray returns an array containing the contents of the List.
// This requires copying the List, which is an O(n) operation.
public static List<R> ToList<T, R>(this PooledRefList<T> poolList) where T : R
{
var size = poolList._size;
var items = poolList._items;
var list = new List<R>(size);
if (size == 0)
{
return list;
}
for (var i = 0; i < items.Length; i++)
{
list.Add(items[i]);
}
return list;
}
public static bool ToBoolean(string value) =>
bool.TryParse(value, out var b)
? b