Esempio n. 1
0
        /// <summary>
        /// Creates new empty synchronized collection of same type.
        /// </summary>
        /// <returns></returns>
        public ListEx <T> CreateSynchronized()
        {
            Type synchronizedType = SynchronizedTypeBuilder.Get(GetType());

            return((ListEx <T>)Activator.CreateInstance(synchronizedType));
        }
Esempio n. 2
0
        /// <summary>
        /// Creates new empty synchronized dictionary of same type.
        /// </summary>
        /// <returns></returns>
        /// <example>
        /// This sample shows how to create synchronized instances.
        /// <code>
        /// public class StringDictionaryEx : DictionaryEx&lt;string, string&gt;
        /// {
        ///     public StringDictionaryEx()
        ///     {
        ///     }
        /// }
        ///
        /// public class TestClass
        /// {
        ///     private DictionaryEx&lt;int, int&gt; synchronizedDictionary = new DictionaryEx&lt;int, int&gt;.CreateSynchronized();
        ///
        ///     private StringDictionaryEx synchronizedStringDictionary = (StringDictionaryEx)new StringDictionaryEx().CreateSynchronized();
        /// }
        /// </code>
        /// </example>
        public DictionaryEx <TKey, TValue> CreateSynchronized()
        {
            Type synchronizedType = SynchronizedTypeBuilder.Get(GetType());

            return((DictionaryEx <TKey, TValue>)Activator.CreateInstance(synchronizedType));
        }