Exemplo n.º 1
0
        /// <summary>
        /// Converts an element initializer to an ITree representation that can be used with rewriter tools.
        /// </summary>
        /// <param name="elementInitializer">Element initializer to convert.</param>
        /// <returns>ITree representation of the element initializer.</returns>
        public static ElementInitExpressionTree ToExpressionTree(this ElementInit elementInitializer)
        {
            if (elementInitializer == null)
            {
                throw new ArgumentNullException(nameof(elementInitializer));
            }

            var visitor = new ExpressionTreeConversion();

            return(visitor.Visit(elementInitializer));
        }
Exemplo n.º 2
0
        /// <summary>
        /// Converts a member binding to an ITree representation that can be used with rewriter tools.
        /// </summary>
        /// <param name="memberBinding">Member binding to convert.</param>
        /// <returns>ITree representation of the member binding.</returns>
        public static MemberBindingExpressionTree ToExpressionTree(this MemberBinding memberBinding)
        {
            if (memberBinding == null)
            {
                throw new ArgumentNullException(nameof(memberBinding));
            }

            var visitor = new ExpressionTreeConversion();

            return(visitor.Visit(memberBinding));
        }
Exemplo n.º 3
0
        /// <summary>
        /// Converts an expression tree to an ITree representation that can be used with rewriter tools.
        /// </summary>
        /// <param name="expression">Expression tree to convert.</param>
        /// <returns>ITree representation of the expression tree.</returns>
        public static ExpressionTree ToExpressionTree(this Expression expression)
        {
            if (expression == null)
            {
                throw new ArgumentNullException(nameof(expression));
            }

            var visitor = new ExpressionTreeConversion();

            return(visitor.Visit(expression));
        }