Finalize :
1.Finalize() is called by the runtime
2.Is a destructor, called by Garbage Collector when the object goes out of scope.
3.Implement it when you have unmanaged resources in your code, and want to make sure that these resources are freed when the Garbage collection happens.
Dispose :
1.Dispose() is called by the user
2.Same purpose as finalize, to free unmanaged resources. However, implement this when you are writing a custom class, that will be used by other users.
3.Overriding Dispose() provides a way for the user code to free the unmanaged objects in your custom class.
http://msdn.microsoft.com/en-us/library/fs2xkftw.aspx
http://www.devx.com/dotnet/Article/33167/0/page/1
Subscribe to:
Post Comments (Atom)

No comments:
Post a Comment