private ZBpara xamBytesToStructB(byte[] arr) { ZBpara struReturn = new ZBpara(); int size = Marshal.SizeOf(struReturn); System.IntPtr ptr = Marshal.AllocHGlobal(size); Marshal.Copy(arr, 0, ptr, arr.Length); struReturn = (ZBpara)Marshal.PtrToStructure(ptr, struReturn.GetType()); Marshal.FreeHGlobal(ptr); return(struReturn); }