/// <summary> /// From the serializable. /// </summary> /// <param name="methodCallExpressionRepresentation">The methodCall expression.</param> /// <returns> /// Converted expression. /// </returns> public static MethodCallExpression FromRepresentation( this MethodCallExpressionRepresentation methodCallExpressionRepresentation) { if (methodCallExpressionRepresentation == null) { throw new ArgumentNullException(nameof(methodCallExpressionRepresentation)); } var instance = methodCallExpressionRepresentation.ParentObject.FromRepresentation(); var method = methodCallExpressionRepresentation.Method.FromRepresentation(); var arguments = methodCallExpressionRepresentation.Arguments.FromRepresentation(); var result = Expression.Call( instance, method, arguments); return(result); }
/// <summary> /// Converts to serializable. /// </summary> /// <param name="methodCallExpression">The methodCall expression.</param> /// <returns> /// Serializable expression. /// </returns> public static MethodCallExpressionRepresentation ToRepresentation( this MethodCallExpression methodCallExpression) { if (methodCallExpression == null) { throw new ArgumentNullException(nameof(methodCallExpression)); } var type = methodCallExpression.Type.ToRepresentation(); var nodeType = methodCallExpression.NodeType; var parentObject = methodCallExpression.Object.ToRepresentation(); var method = methodCallExpression.Method.ToRepresentation(); var parameters = methodCallExpression.Arguments.ToRepresentation(); var result = new MethodCallExpressionRepresentation(type, nodeType, parentObject, method, parameters); return(result); }