public override object ParseValue(PropertyItem item)
        {
            String str = item.GetString();

            if (item.Len == 10)
            {
                return(DateTime.ParseExact(str, "yyyy:MM:dd", CultureInfo.InvariantCulture));
            }

            return(DateTime.ParseExact(str, "yyyy:MM:dd HH:mm:ss", CultureInfo.InvariantCulture));
        }
Esempio n. 2
0
        private static object ParseValue(PropertyInfo prop, PropertyItem item)
        {
            switch (prop.PropertyType.Name)
            {
            case "String":
                return(item.GetString());

            case "Int32":
                return(BitConverter.ToInt16(item.Value, 0));
            }

            // Any parser attributes?
            TypeParserAttribute parser = prop.GetCustomAttribute <TypeParserAttribute>();

            if (parser != null)
            {
                return(parser.ParseValue(item));
            }

            return(null);
        }