Search code examples
c#idisposablewebsocket-sharp

Class that implements IDisposable without Dispose function?


I just pulled in WebSocketSharp via nuget.
It's class WebSocket implements IDisposable but doesn't seem to have a Dispose method.
How is that possible? I thought if you implement an interface you also have to implement all of it's properties/methods.

Screenshot


Solution

  • On GitHub in source:

    #region Explicit Interface Implementations
    
    /// <summary>
    /// Closes the WebSocket connection, and releases all associated resources.
    /// </summary>
    /// <remarks>
    /// This method closes the connection with <see cref="CloseStatusCode.Away"/>.
    /// </remarks>
    void IDisposable.Dispose ()
    {
      close (new CloseEventArgs (CloseStatusCode.Away), true, true, false);
    }
    
    #endregion