Exemple #1
0
            public Object acceptMatch <X>(JamlParser <X> parser, Tobj obj, Match match) where X : new()
            {
                var valueParseMethod = parser.GetType().GetMethod("parseValue").MakeGenericMethod(value);

                Object[] valueParam  = new Object[] { null, match.Groups["value"].Value, value };
                dynamic  parsedValue = parser.invokeMethod(valueParseMethod, parser, valueParam);

                var keyParseMethod = parser.GetType().GetMethod("parseValue").MakeGenericMethod(key);

                Object[] keyParam  = new Object[] { null, match.Groups["key"].Value, key };
                dynamic  parsedKey = parser.invokeMethod(keyParseMethod, parser, keyParam);

                obj.GetType().GetMethod("Add").Invoke(obj, new[] { parsedKey, parsedValue });
                return(parsedValue);
            }
Exemple #2
0
            public Object acceptMatch <X>(JamlParser <X> parser, Tobj obj, Match match) where X : new()
            {
                var parseMethod = parser.GetType().GetMethod("parseValue").MakeGenericMethod(value);

                Object[] param  = new Object[] { null, match.Groups["value"].Value, value };
                dynamic  result = parser.invokeMethod(parseMethod, parser, param);

                obj.GetType().GetMethod("Add").Invoke(obj, new[] { result });
                return(result);
            }