Article Categories
- All Categories
-
Data Structure
-
Networking
-
RDBMS
-
Operating System
-
Java
-
MS Excel
-
iOS
-
HTML
-
CSS
-
Android
-
Python
-
C Programming
-
C++
-
C#
-
MongoDB
-
MySQL
-
Javascript
-
PHP
Selected Reading
What are finalizers in C#?
Finalizers in C# are used to destruct instances of classes. With that, you can also use it to release resources.
Here are some of the key points about Finalizers −
- Only one finalizer is allowed for a class
- You cannot inherit or overload Finalizers
- A finalizer cannot have parameters
- Finalizers invoke automatically
Finalizers in C# are declared like destructors. Let’s say the class name is Demo, therefore, the following would be our finalizer −
~Demo() {
//
}
The finalizer declaration is prefixed with a tilde before the class name.
Advertisements
