private static ValueParserDelegate WrapValueParser(ValueParserDelegate parser) { return((str) => { if (str == "-") { str += "0"; } return parser(str); }); }
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); }
public void AddParser <T>(ValueParserDelegate parser) { Type type = typeof(T); m_Parsers[type] = parser; }