예제 #1
0
        /// <summary>
        /// Copies the Queue elements to an existing one-dimensional Array, starting at the specified array index. 
        /// </summary>
        /// <param name="array">One-dimensional array that is the destination of the items in WorkerThreadQueue.</param>
        /// <param name="index">The zero-based index in array at which copying begins.</param>
        public void CopyTo(Array array, int index)
        {
            if (_workItemQueue == null || _workItemQueue.Count == 0)
                return;

            lock (this.SyncRoot)
            {
                WorkItem[] workItemArray = new WorkItem[_workItemQueue.Count];
                workItemArray.CopyTo(array, index);
            }
        }