AGS.Editor.Components.SpeechComponent.RawSerialize C# (CSharp) Method

RawSerialize() private method

private RawSerialize ( object anything ) : byte[]
anything object
return byte[]
        private byte[] RawSerialize(object anything)
        {
            int rawsize = Marshal.SizeOf(anything);
            IntPtr buffer = Marshal.AllocHGlobal(rawsize);
            Marshal.StructureToPtr(anything, buffer, false);
            byte[] rawdatas = new byte[rawsize];
            Marshal.Copy(buffer, rawdatas, 0, rawsize);
            Marshal.FreeHGlobal(buffer);
            return rawdatas;
        }