예제 #1
0
        /// <summary>
        /// Converts the specified collection of searchbox items to a filter expression.
        /// </summary>
        /// <param name="searchBoxItems">A collection of searchbox items to convert.</param>
        /// <returns>A filter expression.</returns>
        /// <exception cref="ArgumentNullException">The specified value is a null reference.</exception>
        protected static FilterExpressionNode ConvertToFilterExpression(ICollection <SearchTextParseResult> searchBoxItems)
        {
            if (searchBoxItems == null)
            {
                throw new ArgumentNullException("searchBoxItems");
            }

            if (searchBoxItems.Count == 0)
            {
                return(null);
            }
            else
            {
                FilterExpressionAndOperatorNode filterExpression = new FilterExpressionAndOperatorNode();

                foreach (SearchTextParseResult item in searchBoxItems)
                {
                    filterExpression.Children.Add(new FilterExpressionOperandNode(item.FilterRule));
                }

                return(filterExpression);
            }
        }
예제 #2
0
파일: SearchBox.cs 프로젝트: 40a/PowerShell
        /// <summary>
        /// Converts the specified collection of searchbox items to a filter expression.
        /// </summary>
        /// <param name="searchBoxItems">A collection of searchbox items to convert.</param>
        /// <returns>A filter expression.</returns>
        /// <exception cref="ArgumentNullException">The specified value is a null reference.</exception>
        protected static FilterExpressionNode ConvertToFilterExpression(ICollection<SearchTextParseResult> searchBoxItems)
        {
            if (searchBoxItems == null)
            {
                throw new ArgumentNullException("searchBoxItems");
            }

            if (searchBoxItems.Count == 0)
            {
                return null;
            }
            else
            {
                FilterExpressionAndOperatorNode filterExpression = new FilterExpressionAndOperatorNode();

                foreach (SearchTextParseResult item in searchBoxItems)
                {
                    filterExpression.Children.Add(new FilterExpressionOperandNode(item.FilterRule));
                }

                return filterExpression;
            }
        }