Clone() public method

public Clone ( ) : Object
return Object
コード例 #1
0
        public object Clone()
        {
            LogicalCallContext nc = new LogicalCallContext();

            nc._remotingData = (CallContextRemotingData)_remotingData.Clone();
            if (_data != null)
            {
                nc._data = (Hashtable)_data.Clone();
            }

            return(nc);
        }
コード例 #2
0
        public object Clone()
        {
            LogicalCallContext nc = new LogicalCallContext();

            nc._remotingData = (CallContextRemotingData)_remotingData.Clone();
            if (_data != null)
            {
                nc._data = new Hashtable();
                foreach (DictionaryEntry de in _data)
                {
                    nc._data [de.Key] = de.Value;
                }
            }
            return(nc);
        }
コード例 #3
0
ファイル: callcontext.cs プロジェクト: dox0/DotNet471RS3
        [System.Security.SecuritySafeCritical] // overrides public transparent member
        public Object Clone()
        {
            LogicalCallContext lc = new LogicalCallContext();

            if (m_RemotingData != null)
            {
                lc.m_RemotingData = (CallContextRemotingData)m_RemotingData.Clone();
            }
            if (m_SecurityData != null)
            {
                lc.m_SecurityData = (CallContextSecurityData)m_SecurityData.Clone();
            }
            if (m_HostContext != null)
            {
                lc.m_HostContext = m_HostContext;
            }
            lc.m_IsCorrelationMgr = m_IsCorrelationMgr;
            if (HasUserData)
            {
                IDictionaryEnumerator de = m_Datastore.GetEnumerator();

                if (!m_IsCorrelationMgr)
                {
                    while (de.MoveNext())
                    {
                        lc.Datastore[(String)de.Key] = de.Value;
                    }
                }
                else
                {
                    while (de.MoveNext())
                    {
                        String key = (String)de.Key;

                        // Deep clone "System.Diagnostics.Trace.CorrelationManagerSlot"
                        if (key.Equals(s_CorrelationMgrSlotName))
                        {
                            lc.Datastore[key] = ((ICloneable)de.Value).Clone();
                        }
                        else
                        {
                            lc.Datastore[key] = de.Value;
                        }
                    }
                }
            }
            return(lc);
        }
コード例 #4
0
        // ICloneable::Clone
        // Used to create a (somewhat lame) deep copy of the call context
        // when an async call starts

        // FUTURE: This needs to be revisited ... ideally the call
        // context data should be deep-copied for each Async call ... may be
        // by providing the user with the option through new parameters to
        // BeginInvoke & EndInvoke
        /// <include file='doc\CallContext.uex' path='docs/doc[@for="LogicalCallContext.Clone"]/*' />
        public Object Clone()
        {
            LogicalCallContext lc = new LogicalCallContext();

            if (m_RemotingData != null)
            {
                lc.m_RemotingData = (CallContextRemotingData)m_RemotingData.Clone();
            }
            if (m_SecurityData != null)
            {
                lc.m_SecurityData = (CallContextSecurityData)m_SecurityData.Clone();
            }
            if (HasUserData)
            {
                IDictionaryEnumerator de = m_Datastore.GetEnumerator();

                while (de.MoveNext())
                {
                    lc.Datastore[(String)de.Key] = de.Value;
                }
            }
            return(lc);
        }