Ejemplo n.º 1
0
        /// <summary>
        /// Provide structural equality comparison
        /// </summary>
        /// <param name="obj">the other value</param>
        /// <returns>true if equal, false otherwise</returns>
        public override bool Equals(object obj)
        {
            ExpressionIdentifier other = obj as ExpressionIdentifier;

            if ((object)other != null)
            {
                return(Name.Equals(other.Name, StringComparison.Ordinal));
            }

            return(false);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Find all of the identifiers referenced in the expression.
        /// </summary>
        /// <returns>the set of referenced identifiers.</returns>
        public ReadOnlyCollection <ExpressionIdentifier> Identifiers()
        {
            HashSet <ExpressionIdentifier> identifiers = new HashSet <ExpressionIdentifier>();

            Traverse(
                delegate(Expression expression)
            {
                ExpressionIdentifier identifier = expression as ExpressionIdentifier;

                if ((object)identifier != null)
                {
                    if (!identifiers.Contains(identifier))
                    {
                        identifiers.Add(identifier);
                    }
                }
            });


            return((new List <ExpressionIdentifier>(identifiers)).AsReadOnly());
        }