public static IntPtr PackSerializedData(MsgPackWriter writer) { IntPtr dataPtr = writer.GetUnsafeBufferPtr(); *(int *)dataPtr = writer.GetBufferLength(); return(dataPtr); }