/// <summary>
        /// Gets the generic dictionary.
        /// </summary>
        /// <param name="context">The context.</param>
        /// <param name="reader">The reader.</param>
        /// <param name="key">The key.</param>
        /// <param name="defaultValue">The default value.</param>
        /// <returns></returns>
        public static SortedList <TKey, TValue> GetGenericDictionary <TKey, TValue>(StreamingContext context, SerializationInfoReader reader, string key, SortedList <TKey, TValue> defaultValue)
        {
            SortedList <TKey, TValue> dictionary;

            if (context.State == StreamingContextStates.Persistence)
            {
                TKey[] keys = (TKey[])reader.GetValue(key + "_" + "key", typeof(TKey[]), null);
                if (keys == null)
                {
                    return(defaultValue);
                }
                TValue[] values = (TValue[])reader.GetValue(key + "_" + "value", typeof(TValue[]), null);
                dictionary = new SortedList <TKey, TValue>(keys.Length);
                for (int iPos = 0; iPos < keys.Length; iPos++)
                {
                    TKey   link       = keys[iPos];
                    TValue objectLink = values[iPos];
                    dictionary.Add(link, objectLink);
                }
            }
            else
            {
                dictionary = (SortedList <TKey, TValue>)reader.GetValue(key, typeof(SortedList <TKey, TValue>), defaultValue);
            }
            return(dictionary);
        }
        /// <summary>
        /// Gets the generic list.
        /// </summary>
        /// <param name="context">The context.</param>
        /// <param name="reader">The reader.</param>
        /// <param name="key">The key.</param>
        /// <param name="defaultValue">The default value.</param>
        /// <returns></returns>
        public static List <TValue> GetGenericList <TValue>(StreamingContext context, SerializationInfoReader reader, string key, List <TValue> defaultValue)
        {
            List <TValue> list;

            if (context.State == StreamingContextStates.Persistence)
            {
                TValue[] values = (TValue[])reader.GetValue(key, typeof(TValue[]), null);
                if (values == null)
                {
                    return(defaultValue);
                }

                list = new List <TValue>(values);
            }
            else
            {
                list = (List <TValue>)reader.GetValue(key, typeof(List <TValue>), defaultValue);
            }
            return(list);
        }