托管变量变为非托管变量
string a="";
string b;
int str_size = Marshal.SizeOf(a);
IntPtr buffer = Marshal.AllocHGlobal(str_size); // 从进程的非托管内存中给DevBroadcastDeviceinterface分配内存
Marshal.StructureToPtr(b, buffer, true); // 将数据从托管对象封送到非托管内存块(dbi->buffer,删除旧的数据)
标签:变量,C#,托管,buffer,Marshal,size
From: https://www.cnblogs.com/qq2806933146xiaobai/p/16898788.html