top button
Flag Notify
    Connect to us
      Site Registration

Site Registration

What is the difference between “finalize” and “finally” methods in C#?

0 votes
399 views
What is the difference between “finalize” and “finally” methods in C#?
posted Apr 9, 2017 by Pooja Bhanout

Share this question
Facebook Share Button Twitter Share Button LinkedIn Share Button

1 Answer

0 votes

final – constant declaration.

finally – The finally block always executes when the try block exits, except System.exit(0) call. This ensures that the finally block is executed even if an unexpected exception occurs.

finalize() – method helps in garbage collection. A method that is invoked before an object is discarded by the garbage collector, allowing it to clean up its state.

answer Apr 10, 2017 by Manikandan J
...