mirror of
https://github.com/kwsch/PKHeX
synced 2024-11-26 22:10:21 +00:00
Update EncounterEvent.cs
This commit is contained in:
parent
8222297da8
commit
ad79833420
1 changed files with 4 additions and 2 deletions
|
@ -68,8 +68,8 @@ namespace PKHeX.Core
|
|||
{
|
||||
static void AddOrExpand<T>(ref ICollection<T> arr, T obj)
|
||||
{
|
||||
if (arr is HashSet<T>)
|
||||
arr.Add(obj);
|
||||
if (arr is HashSet<T> h)
|
||||
h.Add(obj);
|
||||
else
|
||||
arr = new HashSet<T>(arr) {obj};
|
||||
}
|
||||
|
@ -88,6 +88,8 @@ namespace PKHeX.Core
|
|||
{
|
||||
if (arr is T[] x)
|
||||
return x;
|
||||
|
||||
// rather than use Linq to build an array, just do it the quick way directly.
|
||||
var result = new T[arr.Count];
|
||||
((HashSet<T>)arr).CopyTo(result, 0);
|
||||
return result;
|
||||
|
|
Loading…
Reference in a new issue