// Copyright (c) 2019 Jean-Philippe Bruyère // // This code is licensed under the MIT license (MIT) (http://opensource.org/licenses/MIT) using System; using System.Collections.Generic; using System.Runtime.InteropServices; namespace Vulkan { /// /// Keep pinned object gc handles and free them on dispose. /// public class PinnedObjects : IDisposable { public readonly List Handles = new List (); public void Dispose () { for (int i = Handles.Count - 1; i >= 0; i--) Handles[i].Free (); GC.SuppressFinalize (this); } } }