///-------------------------------------------------------------------------------------------------
        /// <summary>
        ///  When overridden in a derived class, dispatches an asynchronous message to a synchronization
        ///  context.
        /// </summary>
        /// <param name="d">
        ///  The <see cref="T:System.Threading.SendOrPostCallback" /> delegate to call.
        /// </param>
        /// <param name="state">
        ///  The object passed to the delegate.
        /// </param>
        ///-------------------------------------------------------------------------------------------------
        public override void Post(SendOrPostCallback d, object state)
        {
            Action continuation = () =>
            {
                SetSynchronizationContext(this);
                ((Action)state)();
            };

            if (OldContext != null)
            {
                OldContext.Post(d, continuation);
            }
            else
            {
                base.Post(d, continuation);
            }
        }