Example #1
0
        /// <summary>
        /// 实现Dispose释放
        /// </summary>
        /// <param name="disposing"></param>
        protected override void Dispose(bool disposing)
        {
            try
            {
                if (Disposed)
                {
                    return;
                }

                // 清理托管资源
                if (disposing)
                {
                    //释放实例的静态类对象
                    ms_objClass = null;
                }

                // 清理非托管资源

                //让类型知道自己已经被释放
                Disposed = true;
            }
            catch
            {
                throw;
            }
        }
Example #2
0
 public static clsLocation Instance()
 {
     if (ms_objClass == null)
     {
         //实例新静态类,并标识需释放
         ms_objClass          = new clsLocation();
         ms_objClass.Disposed = false;   //标识需释放
     }
     return(ms_objClass);
 }