Ejemplo n.º 1
0
        /// <summary>
        /// Parses the string for an identifier. Only accepted characters are those valid in identifiers, and the property operator.
        /// </summary>
        /// <param name="name">The string to parse for an identifier</param>
        /// <returns>The parsed identifier as an expression chain.</returns>
        public static Expression ParseId(string name)
        {
            if (name == null)
            {
                throw new ArgumentNullException("name");
            }

            string[]   identifiers = name.Split('.');
            Expression result      = null;

            foreach (string identifier in identifiers)
            {
                if (result == null)
                {
                    result = Id(identifier);
                }
                else
                {
                    result = new PropertyOperationExpression(result, identifier);
                }
            }

            return(result);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Parses the string for an identifier. Only accepted characters are those valid in identifiers, and the property operator.
        /// </summary>
        /// <param name="name">The string to parse for an identifier</param>
        /// <returns>The parsed identifier as an expression chain.</returns>
        public static Expression ParseId(string name)
        {
            if (name == null)
            {
                throw new ArgumentNullException("name");
            }

            string[] identifiers = name.Split('.');
            Expression result = null;

            foreach (string identifier in identifiers)
            {
                if (result == null)
                {
                    result = Id(identifier);
                }
                else
                {
                    result = new PropertyOperationExpression(result, identifier);
                }
            }

            return result;
        }