mirror of
https://github.com/AlexMacocian/MonoGame.Extended.git
synced 2026-07-21 01:39:32 +00:00
Fix Clear method (#614)
Make sure to clear the array before setting count to zero.
This commit is contained in:
@@ -85,11 +85,11 @@ namespace MonoGame.Extended.Collections
|
||||
if(Count == 0)
|
||||
return;
|
||||
|
||||
Count = 0;
|
||||
|
||||
// non-primitive types are cleared so the garbage collector can release them
|
||||
if (!_isPrimitive)
|
||||
Array.Clear(_items, 0, Count);
|
||||
|
||||
Count = 0;
|
||||
}
|
||||
|
||||
public bool Contains(T element)
|
||||
@@ -191,4 +191,4 @@ namespace MonoGame.Extended.Collections
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user