Implementing IDisposable

This commit is contained in:
salar2k 2016-12-15 23:32:23 +03:30
parent ca6e18b50e
commit fc09dba71b

View file

@ -21,7 +21,7 @@ using TLAuthorization = TeleSharp.TL.Auth.TLAuthorization;
namespace TLSharp.Core
{
public class TelegramClient
public class TelegramClient : IDisposable
{
private MtProtoSender _sender;
private AuthKey _key;
@ -333,6 +333,15 @@ namespace TLSharp.Core
_session.Save();
}
public void Dispose()
{
if (_transport != null)
{
_transport.Dispose();
_transport = null;
}
}
}
public class MissingApiConfigurationException : Exception