自己备用
public static class PHDApi : IDisposable { private PHDAccess _phd = null; // Track whether Dispose has been called. private bool disposed = false; ~PHDApi() { Dispose(false); } public PHDAccess phd { get { if (_phd == null) _phd = new PHDAccess(); return _phd; } set { _phd = value; } } public void Dispose() { Dispose(true); GC.SuppressFinalize(this); } protected virtual void Dispose(bool disposing) { if (!this.disposed) { if (disposing && _phd != null) { _phd.Dispose(); _phd = null; } disposed = true; } } }