using System; using System.Runtime.InteropServices; namespace ComputeSharp.Core.NetStandard.System.Runtime.CompilerServices; /// /// A polyfill type that mirrors some methods from on .NET 5. /// internal static class RuntimeHelpers { /// /// Allocates some memory tied to the lifetime of a specific type. /// /// The type to associate the memory to. /// The size in byte of the memory to allocate. /// A pointer to the allocated memory. public static IntPtr AllocateTypeAssociatedMemory(Type type, int size) => Marshal.AllocHGlobal(size); }