
- C# Basic Tutorial
- C# - Home
- C# - Overview
- C# - Environment
- C# - Program Structure
- C# - Basic Syntax
- C# - Data Types
- C# - Type Conversion
- C# - Variables
- C# - Constants
- C# - Operators
- C# - Decision Making
- C# - Loops
- C# - Encapsulation
- C# - Methods
- C# - Nullables
- C# - Arrays
- C# - Strings
- C# - Structure
- C# - Enums
- C# - Classes
- C# - Inheritance
- C# - Polymorphism
- C# - Operator Overloading
- C# - Interfaces
- C# - Namespaces
- C# - Preprocessor Directives
- C# - Regular Expressions
- C# - Exception Handling
- C# - File I/O
- C# Advanced Tutorial
- C# - Attributes
- C# - Reflection
- C# - Properties
- C# - Indexers
- C# - Delegates
- C# - Events
- C# - Collections
- C# - Generics
- C# - Anonymous Methods
- C# - Unsafe Codes
- C# - Multithreading
- C# Useful Resources
- C# - Questions and Answers
- C# - Quick Guide
- C# - Useful Resources
- C# - Discussion
final, finally and finalize in C#
final
Java has final keyword, but C# does not have its implementation. For the same implementation, use the sealed keyword.
With sealed, you can prevent overriding of a method. When you use sealed modifiers in C# on a method, then the method loses its capabilities of overriding. The sealed method should be part of a derived class and the method must be an overridden method.
Finally
The finally block is used to execute a given set of statements, whether an exception is thrown or not thrown. For example, if you open a file, it must be closed whether an exception is raised or not.
Finalize
The Finalize in C# is used to free unmanaged resources like database connections etc. The method finalize() is for unmanaged resources.
- Related Articles
- final, finally and finalize in Java
- Difference Between Final, Finally and Finalize in Java
- What is the difference between final, finally and finalize() in Java?
- Difference Between dispose() and finalize() in C#
- What is the difference between Finalize and Dispose in C#?
- Finally keyword in C#
- Try-Catch-Finally in C#
- Private and final methods in C#
- What is finally statement in C#?
- How many times finalize method will be invoked? who invokes finalize() method in Java?
- Final keyword in C#
- Final variables in C#
- Try/catch/finally/throw keywords in C#
- Explain final class and final method in PHP.
- Flow control in try catch finally in C#

Advertisements