public void Dispose() { if (handle != 0) { SpssSafeWrapper.spssCloseRead(handle); handle = 0; } }
/// <summary> /// When overridden in a derived class, executes the code required to free the handle. /// </summary> /// <returns> /// true if the handle is released successfully; otherwise, in the event of a catastrophic failure, false. In this case, it generates a releaseHandleFailed MDA Managed Debugging Assistant. /// </returns> protected override bool ReleaseHandle() { switch (this.accessMode) { case SpssFileAccess.Read: ReturnCode result = SpssSafeWrapper.spssCloseRead(this.handle.ToInt32()); return(result == ReturnCode.SPSS_OK); case SpssFileAccess.Append: result = SpssSafeWrapper.spssCloseAppendImpl(this.handle.ToInt32()); return(result == ReturnCode.SPSS_OK); case SpssFileAccess.Create: result = SpssSafeWrapper.spssCloseWriteImpl(this.handle.ToInt32()); return(result == ReturnCode.SPSS_OK || result == ReturnCode.SPSS_DICT_NOTCOMMIT); default: return(false); } }