-1

what does "~" mean before a constructor definition in c#? I can't find the answer on the internet and it's giving me trouble.

I encountered it on line 45 in this file

https://github.com/zeul72/SocketsProgramming/blob/90ff469b7e5f416c80256562ec8e96f282b930b9/EP02%20-%20SocketsProgramming/Shared/Channel.cs

 public abstract class Channel<TProtocol, TMessageType> : IDisposable
        where TProtocol : Protocol<TMessageType>, new() {
    
 [...]

 ~Channel( ) => Dispose( false );
 
 [...]

}

incubo4u
  • 77
  • 2
  • 5

1 Answers1

2

This is called the destructor that is the oposite of the constructor. Destructor is called when GC is destroying/deallocate that memory space.