-1

The code:

public class UnitOfWork : IUnitOfWork 
{
...
    ~UnitOfWork()
    {
        dispose(false);
    }
}

What the ~ means?

Full code is here: https://github.com/timschreiber/DapperUnitOfWork/blob/master/DapperUnitOfWork/UnitOfWork.cs

Red Wei
  • 854
  • 6
  • 22

1 Answers1

0

~UnitOfWork() is the declaration of the destructor of the class public class UnitOfWork.

Here's an (IMO) an interesting part to note about the destructors:

The programmer has no control over when the destructor is called because this is determined by the garbage collector. The garbage collector checks for objects that are no longer being used by the application. If it considers an object eligible for destruction, it calls the destructor (if any) and reclaims the memory used to store the object. Destructors are also called when the program exits.

Thomas Ayoub
  • 29,063
  • 15
  • 95
  • 142