/// <summary>
            /// Initializes a new instance of the ThreadSafeEnumerator class, creating a snapshot of the given collection.
            /// </summary>
            /// <param name="collection">List to snapshot.</param>
            public ThreadSafeEnumerator(ThreadSafeCollection <T> collection)
            {
                lock (collection.lockObject)
                {
                    // Make snapshot of passed in collection.
                    this.collection = new ThreadSafeCollection <T>();
                    this.collection.AddRange(collection);

                    // Wrapped enumerator.
                    enumerator = this.collection.list.GetEnumerator();
                }
            }
 /// <summary>
 /// Initializes a new instance of the ContextEventWrapper class.
 /// </summary>
 /// <param name="method">Determines whether the context will use Post or Send. Default is Post.</param>
 public ContextEventWrapper(ContextSynchronizationMethod method)
 {
     isDisposed     = false;
     this.method    = method;
     actualHandlers = new ThreadSafeCollection <ContextHandlerPair>();
 }