public byte[] GetModelRaw() { int length; IntPtr dumpPtr; int output = XGBoostNative.XGBoosterGetModelRaw(handle, out length, out dumpPtr); if (output == -1) { throw new DllFailException(XGBoostNative.XGBGetLastError()); } byte[] modelBytes = new byte[length]; Marshal.Copy(dumpPtr, modelBytes, 0, length); return(modelBytes); }