public static object ToObject(Type type, Dictionary <string, string> dic, string keyPrefix = "")
        {
            if (dic == null)
            {
                throw new ArgumentException("dic");
            }

            if (dic.Count == 0)
            {
                return(null);
            }

            TypeAccessor ta = TypeAccessor.GetAccessor(type);

            object[] values = new object[ta.ReadWriteProperties.Count];
            int      index  = 0;

            foreach (var property in ta.ReadWriteProperties)
            {
                string str;
                if (dic.TryGetValue(keyPrefix + property.Name, out str))
                {
                    values[index] = FromString(str, property.PropertyType);
                }
                index++;
            }

            object instance = ta.Create();

            ta.SetReadWritePropertyValues(instance, values);

            return(instance);
        }
        public static object ToObject(Type type, string[] stringValues)
        {
            if (stringValues == null)
            {
                throw new ArgumentException("stringValues");
            }

            TypeAccessor ta = TypeAccessor.GetAccessor(type);

            if (stringValues.Length != ta.ReadWriteProperties.Count)
            {
                throw new ArgumentException(String.Format("给定数据的个数 {0} 与类型 {1} 的读写属性个数 {2} 不一致", stringValues.Length, type.FullName, ta.ReadWriteProperties.Count));
            }

            object[] values = new object[stringValues.Length];
            int      index  = 0;

            foreach (var property in ta.ReadWriteProperties)
            {
                values[index] = FromString(stringValues[index], property.PropertyType);
                index++;
            }

            object instance = ta.Create();

            ta.SetReadWritePropertyValues(instance, values);

            return(instance);
        }