Life Cycle of Object
来源:互联网 发布:策划 知乎 编辑:程序博客网 时间:2024/05/14 20:20
Garbage collection, managed heap.
Set object to null.
Application root.
Generation.
System.GC type
GC.Collect();
GC.WaitForPendingFinalizers();
class A
{
~A()
{
//clear unmanaged resources.
}
}
public interface IDisposable
{
void Dispose();
}
public class A:IDisposable
{
Private bool disposed=false;
public void Dispose()
{
//clear unmanaged resources.
}
private void CleanUp(bool disposing)
{
If(!this.disposed)
{
if(disposing)
{
//free managed resources.
}
}
disposed=true;
}
~A()
{
//clear unmanaged resources.
CleanUp(false);
}
}
Using(A a=new A())
{
//automatically call Dispose() when exit.
}
- Life Cycle of Object
- The Life Cycle of Hibernate entity object
- Handling IRPs 11: Life Cycle of a File Object
- Life Cycle of Threads
- Entity,Object Identity And Object Life Cycle
- The Life Cycle of a JSP Page
- Life Cycle of a Linux Program
- Oracle Table Relationship SQL of Procure To Pay Life Cycle
- DOJO组件生命周期(the life cycle of dojo widget)
- DOJO组件生命周期(the life cycle of dojo widget)
- 【Java多线程】之四:Life Cycle of Thread
- React Native -- The Life-Cycle of a Composite Component
- DOJO组件生命周期(the life cycle of dojo widget)
- Servlet life cycle
- Software Development Life-Cycle
- UIComponent之life cycle
- Bug life cycle
- Activity life cycle
- C3P0 代码分析
- Inheritance and polymorphism
- Objective-c SEL & Class IMP
- System.Exception
- 说说代码之美
- Life Cycle of Object
- android 反编译
- spring面试大全(一)
- android 反编译
- JSTL之数字、日期格式化---(转载)
- Basic knowledge
- 代码设计的一些原则
- android 反编译
- OUR_MIFARE.dll动态库使用说明