コード例 #1
0
        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));
            }
        }
コード例 #2
0
 public string ToNumber(XmlNumber xmlValue)
 {
     return(this.xmlService.GetNumberNode(xmlValue.NodeName, xmlValue.Value));
 }
コード例 #3
0
        protected object ResolveValue(Type propertyType, XmlNumber xmlValue)
        {
            var type = this.assemblyInfoService.GetNullableUnderlyingType(propertyType);

            return(this.assemblyInfoService.ConvertValueToPropertyType(xmlValue.Value, type));
        }