public static object ToObject(this IDictionary <string, object> values, Type objectType) { Guard.NotEmpty(values, nameof(values)); Guard.NotNull(objectType, nameof(objectType)); if (!DictionaryConverter.CanCreateType(objectType)) { throw Error.Argument( "objectType", "The type '{0}' must be a class and have a parameterless default constructor in order to deserialize properly.", objectType.FullName); } return(DictionaryConverter.SafeCreateAndPopulate(objectType, values)); }
public override bool CanConvertTo(Type type) { return(DictionaryConverter.CanCreateType(type)); }
public override bool CanConvertTo(Type type) { return(!type.IsPredefinedType() && DictionaryConverter.CanCreateType(type)); }