日期:2014-05-18 浏览次数:21205 次
float[] m = new float[6]; int size = sizeof(float) * m.Length; IntPtr ptr = Marshal.AllocHGlobal(size); Marshal.Copy(m, 0, ptr, m.Length);
------解决方案--------------------
float[]a={0.231,0.154};
IntPtr p;
Marshal.Copy(a,0,p,a.Length);
------解决方案--------------------
float[] f = new float[] {1f,2f,3f}; unsafe { fixed (float* pf = f) { IntPtr address = new IntPtr(pf); } }
------解决方案--------------------
float[] f = new float[10];
IntPtr[] intptr = f.Select(t => new IntPtr(Convert.ToInt32(t))).ToArray();