Fix Clear method (#614)

Make sure to clear the array before setting count to zero.
This commit is contained in:
rumkuhgel
2019-07-02 02:38:14 +02:00
committed by Dylan Wilson
parent 31b77e5689
commit 130daf3e5e
+3 -3
View File
@@ -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
}
}
}
}
}