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); }
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); }