internal byte[] Serialize() { int birsize = Marshal.SizeOf(typeof(bioapi_bir)); byte[] birBytes = new byte[birsize + BiometricData.Length]; GCHandle gcheader = GCHandle.Alloc(birBytes, GCHandleType.Pinned); Marshal.StructureToPtr(bir_, gcheader.AddrOfPinnedObject(), false); gcheader.Free(); BiometricData.CopyTo(birBytes, birsize); return(birBytes); }