Example #1
0
        /// <summary>
        /// Visits the children of the given payload element and replaces it with a copy if any child changes
        /// </summary>
        /// <param name="payloadElement">The payload element to potentially replace</param>
        /// <returns>The original element or a copy to replace it with</returns>
        public virtual ODataPayloadElement Visit(PrimitiveCollection payloadElement)
        {
            ExceptionUtilities.CheckArgumentNotNull(payloadElement, "payloadElement");
            var replaced = this.VisitCollection(payloadElement);

            if (!this.ShouldReplace(replaced, payloadElement))
            {
                return(payloadElement);
            }

            return(payloadElement.ReplaceWith(new PrimitiveCollection(replaced.ToArray())));
        }