Mega Code Archive

 
Categories / C# by API / System Runtime Interopservices
 

Marshal AllocHGlobal

using System; using System.Runtime.InteropServices; public class MainClass {   [STAThread]   static void Main(string[] args)   {     IntPtr ptr = IntPtr.Zero;     ptr = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(int)));     Marshal.FreeHGlobal(ptr);   } }