public void Dispose()
        {
            Cancel();
            if (this.worker?.ThreadState == System.Threading.ThreadState.Running)
            {
                this.worker.Abort();
            }

            IsWorkingObservable.OnCompleted();
        }
        /// <summary>
        /// Creates new instance of <see cref="FileEnumerator"/>.
        /// </summary>
        /// <param name="list">Writable collection for live adding searched <see cref="FileInfo"/>.</param>
        /// <exception cref="ArgumentNullException"/>
        /// <exception cref="ArgumentException"/>
        public FileEnumerator(ICollection <FileInfo> list)
        {
            List = list ?? throw new ArgumentNullException(nameof(list));

            if (List.IsReadOnly)
            {
                throw new ArgumentException("List is read-only.");
            }

            IsWorkingObservable.OnNext(false);
        }
 private void ThreadStart()
 {
     IsWorkingObservable.OnNext(true);
     EnumerateFiles(StartingPath);
     IsWorkingObservable.OnNext(false);
 }