CmisSync.Lib.Queueing.ConnectionScheduler.Dispose C# (CSharp) Method

Dispose() public method

Releases all resource used by the CmisSync.Lib.Queueing.SyncScheduler object.
Call Dispose when you are finished using the CmisSync.Lib.Queueing.SyncScheduler. The Dispose method leaves the CmisSync.Lib.Queueing.SyncScheduler in an unusable state. After calling Dispose, you must release all references to the CmisSync.Lib.Queueing.SyncScheduler so the garbage collector can reclaim the memory that the CmisSync.Lib.Queueing.SyncScheduler was occupying.
public Dispose ( ) : void
return void
        public void Dispose() {
            if (this.task != null) {
                try {
                    this.cancelTaskSource.Cancel();
                    this.task.Wait(this.Interval);
                    this.task.Dispose();
                } catch (InvalidOperationException) {
                    // Disposing the login task before it is finished is not a problem
                } catch (TaskCanceledException) {
                    // It is fine if the task is canceled
                } catch (AggregateException) {
                    // It is also fine if the task is canceled
                } finally {
                    this.cancelTaskSource.Dispose();
                }
            }
        }