crackyourinterview.com


To improves our performance please Like Share Subscribe(Will boost us)

Five main difference between Finalize and Dispose?
Question Posted on 26 Apr 2020Home >> DotNet >> C# >> Five main difference between Finalize and Dispose?

Five main difference between Finalize and Dispose?
Below are the 5 main difference between Finalize and Dispose.
Finalize:-
(1)It is basically used to free unmanaged resources and example of these resources are Files, Database connections in application domain and many other resources. And these resources are held by an object before that object is destroyed.
(2)It is internal process and called by Garbage Collector automatically and we cannot called it manually by user code or by any other service.
(3)Finalize belongs to object class.
(4)This will implement when we have unmanaged resource in our code and we need to make sure that resource is freed when Garbage Collection happens.
(5)We will notice some effect on performance of website when garbage Collector is called and it will not suitable to free objects immediately.

Dispose:-
(1)Dispose is also used to free unmanaged resources that are not in use and example are Files and database connections in the application domain at any time.
(2)In dispose we will called it explicitly by manual user code.
(3)This Dispose() method belongs to IDisposable interface.
(4)If we need to implement this method for any custom classes we need to inherit the class from IDisposable interface.
(5)It will not show any effect on performance of website and we can use this method whenever we want to free objects immediately.
0
0



.


Most Visited Questions:-

Deep Learning Questions Answers
Below are the different Deep Leaning Questions and answer a More...

Continuous Integration Questions Answers
Below are the 20 odd questions for CI or Continuous Integra More...

Derived relationships in Association Rule Mining are represented in the form of __________.
Derived relationships in Association Rule Mining are repres More...

What is Gulpjs and some multiple choice questions on Gulp
Gulpjs is an open source whihc helps in building Javascript More...

Microservices Architecture Questions Answers
Below are the different questions on Microservices Architec More...




Other Important Questions

Simplest definition of partial classes and its rules?

Definition of Tuple class with some examples?

Define Race Condition in cSharp?

C#.Net Reserve Words

can we inherit private class level variables in c#






@2014-2022 Crackyourinterview (All rights reserved)
Privacy Policy - Disclaimer - Sitemap