示例#1
0
 /// <summary>
 /// Remove a property from the global context
 /// </summary>
 /// <param name="key">the key for the entry to remove</param>
 /// <remarks>
 /// <para>
 /// Removing an entry from the global context properties is relatively expensive compared
 /// with reading a value.
 /// </para>
 /// </remarks>
 public void Remove(string key)
 {
     lock (m_syncRoot)
     {
         if (m_readOnlyProperties.Contains(key))
         {
             PropertiesDictionary propertiesDictionary = new PropertiesDictionary(m_readOnlyProperties);
             propertiesDictionary.Remove(key);
             m_readOnlyProperties = new ReadOnlyPropertiesDictionary(propertiesDictionary);
         }
     }
 }
        /// <summary>
        /// Remove a property from the global context
        /// </summary>
        /// <param name="key">the key for the entry to remove</param>
        /// <remarks>
        /// <para>
        /// Removing an entry from the global context properties is relatively expensive compared
        /// with reading a value.
        /// </para>
        /// </remarks>
        public void Remove(string key)
        {
            lock (m_syncRoot) {
                if (m_readOnlyProperties.Contains(key))
                {
                    var mutableProps = new PropertiesDictionary(m_readOnlyProperties);

                    mutableProps.Remove(key);

                    m_readOnlyProperties = new ReadOnlyPropertiesDictionary(mutableProps);
                }
            }
        }