问题
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.
回答1:
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
来源:https://stackoverflow.com/questions/39366451/class-that-implements-idisposable-without-dispose-function