예제 #1
0
        /// <summary>
        /// From the serializable.
        /// </summary>
        /// <param name="invocationExpressionRepresentation">The invocation expression.</param>
        /// <returns>
        /// Converted expression.
        /// </returns>
        public static InvocationExpression FromRepresentation(
            this InvocationExpressionRepresentation invocationExpressionRepresentation)
        {
            if (invocationExpressionRepresentation == null)
            {
                throw new ArgumentNullException(nameof(invocationExpressionRepresentation));
            }

            var expression = invocationExpressionRepresentation.ExpressionRepresentation.FromRepresentation();

            var arguments = invocationExpressionRepresentation.Arguments.FromRepresentation();

            var result = Expression.Invoke(expression, arguments);

            return(result);
        }
예제 #2
0
        /// <summary>
        /// Converts to serializable.
        /// </summary>
        /// <param name="invocationExpression">The invocation expression.</param>
        /// <returns>
        /// Serializable expression.
        /// </returns>
        public static InvocationExpressionRepresentation ToRepresentation(
            this InvocationExpression invocationExpression)
        {
            if (invocationExpression == null)
            {
                throw new ArgumentNullException(nameof(invocationExpression));
            }

            var type = invocationExpression.Type.ToRepresentation();

            var expression = invocationExpression.Expression.ToRepresentation();

            var arguments = invocationExpression.Arguments.ToRepresentation();

            var result = new InvocationExpressionRepresentation(type, expression, arguments);

            return(result);
        }