public object ToValue(Type propertyType, XmlNumber xmlValue) { var nullableType = Nullable.GetUnderlyingType(propertyType); if (nullableType != null) { // is nullable return(xmlValue.Value == null ? null : this.ResolveValue(nullableType, xmlValue)); } else if (propertyType == typeof(string)) { return(Convert.ToString(xmlValue.Value, CultureInfo.InvariantCulture)); } else { return(this.ResolveValue(propertyType, xmlValue)); } }
public string ToNumber(XmlNumber xmlValue) { return(this.xmlService.GetNumberNode(xmlValue.NodeName, xmlValue.Value)); }
protected object ResolveValue(Type propertyType, XmlNumber xmlValue) { var type = this.assemblyInfoService.GetNullableUnderlyingType(propertyType); return(this.assemblyInfoService.ConvertValueToPropertyType(xmlValue.Value, type)); }