コード例 #1
0
        public static MemberListBinding FoldMemberListBinding(MemberListBinding inputExpression)
        {
            IEnumerable <ElementInit> initializers = ConstantFolding.FoldElementInitializerList(inputExpression.Initializers);

            if (initializers != inputExpression.Initializers)
            {
                return(Expression.ListBind(inputExpression.Member, initializers));
            }

            return(inputExpression);
        }
コード例 #2
0
        public static Expression FoldListInit(ListInitExpression inputExpression)
        {
            NewExpression             n            = ConstantFolding.FoldNew(inputExpression.NewExpression);
            IEnumerable <ElementInit> initializers = ConstantFolding.FoldElementInitializerList(inputExpression.Initializers);

            if (n != inputExpression.NewExpression || initializers != inputExpression.Initializers)
            {
                return(Expression.ListInit(n, initializers));
            }

            return(inputExpression);
        }