Ejemplo n.º 1
0
 private static ValueParserDelegate WrapValueParser(ValueParserDelegate parser)
 {
     return((str) =>
     {
         if (str == "-")
         {
             str += "0";
         }
         return parser(str);
     });
 }
Ejemplo n.º 2
0
        public object Parse(Type type, string rawValue)
        {
            ValueParserDelegate parser = GetParser(type);

            if (parser != null)
            {
                try
                {
                    return(parser(rawValue));
                }
                catch
                {
                    throw new InvalidValueFormatException(type, rawValue);
                }
            }
            throw new MissingValueParserException(type, rawValue);
        }
Ejemplo n.º 3
0
        public void AddParser <T>(ValueParserDelegate parser)
        {
            Type type = typeof(T);

            m_Parsers[type] = parser;
        }