0

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

BWA
  • 5,672
  • 7
  • 34
  • 45
Michael Pittino
  • 1,556
  • 4
  • 12
  • 18
  • 1
    Explicitly implemented. See https://github.com/sta/websocket-sharp/blob/master/websocket-sharp/WebSocket.cs#L3073 ( and http://stackoverflow.com/questions/4103300/why-implement-interface-explicitly) – haim770 Sep 07 '16 at 09:44
  • Just an idea, maybe somebody can confirm this - if the interface method is implemented explicitly (`explicit interface implementation`), would it be displayed here? Maybe that is the case. – Dennis Sep 07 '16 at 09:44
  • It has an explicit implementation and has a Close() method instead. It's a common pattern. – Dennis_E Sep 07 '16 at 09:46
  • @Chips_100 It would not be displayed here. It's not public. – Dennis_E Sep 07 '16 at 09:47

1 Answers1

4

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
BWA
  • 5,672
  • 7
  • 34
  • 45