public void Dispose() { if (IsDisposed) { return; } lock (SyncObject) { if (IsDisposed) { return; } IsDisposed = true; List <Exception> exceptions = new List <Exception>(); if (mapping != null) { try { mapping.Release(); mapping = null; } catch (Exception ex) { exceptions.Add(ex); } } if (fs != null) { try { fs.Dispose(); fs = null; } catch (Exception ex) { exceptions.Add(ex); } } if (exceptions.Count > 0) { throw new AggregateException(exceptions); } } }
public void Dispose() { if (IsDisposed) { return; } IsDisposed = true; List <Exception> exceptions = new List <Exception>(); if (mapping != null) { try { mapping.Release(); mapping = null; } catch (Exception ex) { exceptions.Add(ex); } } if (memoryMapper != null) { try { memoryMapper.Dispose(); memoryMapper = null; } catch (Exception ex) { exceptions.Add(ex); } } if (exceptions.Count > 0) { throw new AggregateException(exceptions); } }