In doing a code review I came across this:
public class ClassTilda {
~ClassTilda(){
//code
}
}
Why is this building and what is that tilda? Can you provide a reference?
In doing a code review I came across this:
public class ClassTilda {
~ClassTilda(){
//code
}
}
Why is this building and what is that tilda? Can you provide a reference?
This is Destructor, which is basically not suggested to use in C#
.
Destructors are used to destruct instances of classes.
Like was mantioned in comments: there are still cases when you would like to manage, but in most cases it's avoidable as you have:
IDisposable
when dispose is called on instance of your object interface
Finalize()
when GC
is going to clean your type, so called by GC
itself.