Example #1
0
        public IDictionary ReadDictionary(Type dictionaryType)
        {
            var keyType   = dictionaryType.GetGenericArguments()[0];
            var valueType = dictionaryType.GetGenericArguments()[1];
            var keys      = ReadList(typeof(List <>).MakeGenericType(keyType));
            var values    = ReadList(typeof(List <>).MakeGenericType(valueType));

            var dictionary = DictionaryUtils.CreateDictionaryOfTypes(keyType, valueType);

            for (var index = 0; index < keys.Count; index++)
            {
                var key = keys[index];
                dictionary.Add(key, values[index]);
            }

            return(dictionary);
        }