/// <summary> /// Creates a new expression that is like this one, but using the /// supplied children. If all of the children are the same, it will /// return this expression. /// </summary> /// <param name="newExpression">The <see cref="NewExpression" /> property of the result.</param> /// <param name="initializers">The <see cref="Initializers" /> property of the result.</param> /// <returns>This expression if no children changed, or an expression with the updated children.</returns> public ListInitExpression Update(NewExpression newExpression, IEnumerable <ElementInit> initializers) { if (newExpression == NewExpression && initializers != null && ExpressionUtils.SameElements(ref initializers, Initializers.AsArrayInternal())) { return(this); } if (initializers == null) { throw new ArgumentNullException(nameof(initializers)); } return(ListInit(newExpression, initializers)); }