/// <summary> /// Sorts the <see cref="Children"/> collection according to the order of the visual's /// children and their z-index. /// </summary> /// <param name="scene">The scene that the node is a part of.</param> public void SortChildren(Scene scene) { if (_children == null || _children.Count <= 1) { return; } var keys = new List <long>(Visual.VisualChildren.Count); for (var i = 0; i < Visual.VisualChildren.Count; ++i) { var child = Visual.VisualChildren[i]; var zIndex = child.ZIndex; keys.Add(((long)zIndex << 32) + i); } keys.Sort(); _children.Clear(); foreach (var i in keys) { var child = Visual.VisualChildren[(int)(i & 0xffffffff)]; var node = scene.FindNode(child); if (node != null) { _children.Add(node); } } }
/// <summary> /// Dispose and clear component data /// </summary> public void Dispose() { Array.Clear(ComponentTypes, 0, ComponentTypes.Length); entities.Clear(); foreach (var component in Components.Values) { component.Dispose(); } Components.Clear(); entityToIndex.Dispose(); entities.Dispose(); Components.Dispose(); }
public void ForEach_Verify(int count) { PooledList <T> list = GenericListFactory(count); PooledList <T> visitedItems = new PooledList <T>(); void action(T item) { visitedItems.Add(item); } //[] Verify ForEach looks at every item visitedItems.Clear(); list.ForEach(action); VerifyList(list, visitedItems); list.Dispose(); visitedItems.Dispose(); }
private static void Free(PooledList list) { list.Clear(); pool.Free(list); }
internal void Clear() { PooledList <BufferWriterMemory> .Clear(ref this.spanMessages); }