Example #1
0
        public ConstructorDefinition Parse <T>(Expression <Func <CustomConstructBuilder, T> > constructor)
        {
            if (constructor.Body is NewExpression newExpr)
            {
                return(ExpressionParserHelper.CreateConstructorGenerator(newExpr));
            }

            throw new NotSupportedException();
        }
Example #2
0
        public BotConfiguration Parse <T>(Expression <Func <BotConfigurationBuilder, T> > factory)
        {
            if (factory.Body is MemberInitExpression memberInitExpr)
            {
                return(ExpressionParserHelper.ParseMemberInit(memberInitExpr));
            }

            if (factory.Body is NewExpression newExpr)
            {
                return(ExpressionParserHelper.ParseConstructor(newExpr));
            }

            throw new NotSupportedException();
        }