What is the difference between finally and finalize block?



What is the difference between finally and finalize block?..

Answer / Madhumeeta

In C#, `finally` is a clause in a try-catch-finally statement that executes regardless of whether an exception occurs or not. It's used to ensure proper cleanup of resources. On the other hand, `finalize` is a method declared with the `~` symbol before its name and has special meaning for garbage collection.nIt allows you to perform any necessary cleanup when an object is about to be destroyed by the garbage collector.

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More C Sharp Interview Questions

Is string a primitive data type in c#?

1 Answers  


What does void do in unity?

1 Answers  


Which of these statements correctly declares a two-dimensional array in c#?

1 Answers  


What is Covariance and contravariance in C#?

1 Answers   HCL,


what are the bugs are faced in a project

3 Answers   Accenture,


in object oriented programming, how would you describe encapsulation?

1 Answers   Siebel Systems,


What is a sealed class?

1 Answers  


What are the security issues if we send a query from the application?

1 Answers   Microsoft,


Where is the main method in c#?

1 Answers  


What is func c#?

1 Answers  


Explain about finalize method?

1 Answers  


What are accessors?

1 Answers  


Categories