Class that implements IDisposable without Dispose function?

◇◆丶佛笑我妖孽 提交于 2019-12-20 07:26:20

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!