コード例 #1
0
        /// <summary>Will deserialize the dictionary string key-value pairs into the object</summary>
        public static T                                                                         Deserialize <T>(Dictionary <string, string> _dictionary) where T : class, new()
        {
            var serializer = new Object2DictionarySerializer();
            var obj        = new T();

            serializer.SetValuesFromDictionaryIntoComplexType(_dictionary, obj, "");
            return(obj);
        }
コード例 #2
0
        /// <summary>Will deserialize the dictionary string key-value pairs into passed existing object</summary>
        public static void                                                                      Populate(Dictionary <string, string> _dictionary, object _target_object)
        {
            var serializer = new Object2DictionarySerializer();

            if (serializer.IsComplexType(_target_object.GetType()))
            {
                serializer.SetValuesFromDictionaryIntoComplexType(_dictionary, _target_object, "");
            }
        }
コード例 #3
0
        /// <summary>Will deserialize the dictionary string key-value pairs into the object of _target_type type.</summary>
        public static object                                                            Deserialize(Type _target_type, Dictionary <string, string> _dictionary)
        {
            var serializer = new Object2DictionarySerializer();

            var obj = System.Activator.CreateInstance(_target_type);

            serializer.SetValuesFromDictionaryIntoComplexType(_dictionary, obj, "");
            return(obj);
        }