System.Data.Select.SelectRows C# (CSharp) Метод

SelectRows() публичный Метод

public SelectRows ( ) : System.Data.DataRow[]
Результат System.Data.DataRow[]
        public DataRow[] SelectRows()
        {
            bool needSorting = true;

            InitCandidateColumns();

            if (_expression is BinaryNode)
            {
                AnalyzeExpression((BinaryNode)_expression);
                if (!_candidatesForBinarySearch)
                {
                    _linearExpression = _expression;
                }
                if (_linearExpression == _expression)
                {
                    for (int i = 0; i < _candidateColumns.Length; i++)
                    {
                        if (_candidateColumns[i] != null)
                        {
                            _candidateColumns[i].equalsOperator = false;
                            _candidateColumns[i].expr = null;
                        }
                    }
                }
                else
                {
                    needSorting = !FindClosestCandidateIndex();
                }
            }
            else
            {
                _linearExpression = _expression;
            }

            if (_index == null && (_indexFields.Length > 0 || _linearExpression == _expression))
            {
                needSorting = !FindSortIndex();
            }

            if (_index == null)
            {
                CreateIndex();
                needSorting = false;
            }

            if (_index.RecordCount == 0)
                return _table.NewRowArray(0);

            Range range;
            if (_matchedCandidates == 0)
            {
                range = new Range(0, _index.RecordCount - 1);
                Debug.Assert(!needSorting, "What are we doing here if no real reuse of this index ?");
                _linearExpression = _expression;
                return GetLinearFilteredRows(range);
            }
            else
            {
                range = GetBinaryFilteredRecords();
                if (range.Count == 0)
                    return _table.NewRowArray(0);
                if (_matchedCandidates < _nCandidates)
                {
                    BuildLinearExpression();
                }
                if (!needSorting)
                {
                    return GetLinearFilteredRows(range);
                }
                else
                {
                    _records = GetLinearFilteredRecords(range);
                    _recordCount = _records.Length;
                    if (_recordCount == 0)
                        return _table.NewRowArray(0);
                    Sort(0, _recordCount - 1);
                    return GetRows();
                }
            }
        }