Implemented interface member:
1 override of Count
System.Windows.Forms (1)
System\Windows\Forms\DataBinding\BindingsCollection.cs (1)
23public override int Count => _list.Count;
268 references to Count
PresentationUI (4)
MS\Internal\Documents\RMPublishingDialog.cs (1)
561if (rightsTable.SelectedRows.Count == 1)
MS\Internal\Documents\RMPublishingDialog.RightsTable.cs (3)
172if (this.SelectedRows.Count == 1) 502(e.ColumnIndex > 0) && (e.ColumnIndex < Columns.Count)) 791for (int i = RightsTableColumnToIndex(_leftModifiablePermissionColumn); i < Columns.Count - 1; i++)
System.Windows.Forms (228)
System\Windows\Forms\Controls\DataGridView\DataGridView.AccessibleObject.cs (2)
64if (owner.Columns.Count == 0) 113if (!this.TryGetOwnerAs(out DataGridView? owner) || owner.Columns.Count == 0)
System\Windows\Forms\Controls\DataGridView\DataGridView.cs (17)
919DataGridViewAutoSizeColumnMode[] previousModes = new DataGridViewAutoSizeColumnMode[Columns.Count]; 1389get => Columns.Count; 1399if (value != Columns.Count) 1406else if (value < Columns.Count) 1409while (value < Columns.Count) 1411int currentColumnCount = Columns.Count; 1413if (Columns.Count >= currentColumnCount) 1423while (value > Columns.Count) 1425int currentColumnCount = Columns.Count; 1427if (Columns.Count <= currentColumnCount) 1707Debug.Assert(_ptCurrentCell.X < Columns.Count); 1775Debug.Assert(_ptCurrentCell.X >= 0 && _ptCurrentCell.X < Columns.Count); 2304&& firstDisplayedCell.ColumnIndex < Columns.Count); 2445ArgumentOutOfRangeException.ThrowIfGreaterThanOrEqual(value, Columns.Count); 3089for (int columnIndex = 0; columnIndex < Columns.Count; columnIndex++) 3109for (int columnIndex = 0; columnIndex < Columns.Count; columnIndex++) 3207if (Columns.Count == 0)
System\Windows\Forms\Controls\DataGridView\DataGridView.DataConnection.cs (8)
221for (int i = 0; i < _owner.Columns.Count; i++) 237for (int i = 0; i < _owner.Columns.Count; i++) 341Debug.Assert(DataBoundRowsCount() == CurrencyManager!.List!.Count || (_owner.Columns.Count == 0 && dataGridViewRowsCount == 0), 433if (_owner.Columns.Count > 0) 630for (int columnIndex = 0; columnIndex < _owner.Columns.Count; columnIndex++) 679if (_owner.Columns.Count == 0) 1199if (_owner.Columns.Count == 0) 1268|| (columnIndex < _owner.Columns.Count
System\Windows\Forms\Controls\DataGridView\DataGridView.Methods.cs (136)
23if (cellAddress.X < 0 || cellAddress.X >= Columns.Count) 370Debug.Assert(columnIndex >= -1 && columnIndex < Columns.Count); 912autoFillColumns ??= new(Columns.Count); 1381if (Columns.Count == 0 && Rows.Count == 0) 1399allCellsSelected = _individualSelectedCells.Count == Columns.Count * Rows.Count; 1433allCellsSelected = _selectedBandIndexes.Count * Rows.Count + _individualSelectedCells.Count == Columns.Count * Rows.Count; 1469allCellsSelected = _selectedBandIndexes.Count * Columns.Count + _individualSelectedCells.Count == Columns.Count * Rows.Count; 1525DataGridViewColumn[] clonedColumns = new DataGridViewColumn[dataGridViewCols.Count]; 1541for (i = 0; i < dataGridViewCols.Count; i++) 1564while (i < dataGridViewCols.Count) 1715ArgumentOutOfRangeException.ThrowIfGreaterThanOrEqual(columnIndex, Columns.Count); 1765int columnsCount = Columns.Count; 1801ArgumentOutOfRangeException.ThrowIfGreaterThanOrEqual(columnIndex, Columns.Count); 1830int columnsCount = Columns.Count; 1870Debug.Assert(columnIndex >= 0 && columnIndex < Columns.Count); 1935for (int columnIndex = 0; columnIndex < Columns.Count; columnIndex++) 2579Debug.Assert(_ptCurrentCell.X >= 0 && _ptCurrentCell.X < Columns.Count); 3140if (Columns.Count > oldCurrentCellX && Columns[oldCurrentCellX].Visible) 3466ArgumentOutOfRangeException.ThrowIfGreaterThanOrEqual(columnIndexException, Columns.Count); 3475ArgumentOutOfRangeException.ThrowIfGreaterThanOrEqual(columnIndexException, Columns.Count); 3597Debug.Assert(columnIndex >= 0 && columnIndex < Columns.Count, $"Invalid columnIndex: {columnIndex}"); 4148Debug.Assert(columnIndex < Columns.Count); 4190int cellsInCollection = dataGridViewRow.Cells.Count; 4191if (Columns.Count > cellsInCollection) 4194DataGridViewCell[] cells = new DataGridViewCell[Columns.Count - cellsInCollection]; 4195for (int columnIndex = cellsInCollection; columnIndex < Columns.Count; columnIndex++) 5008Debug.Assert(anticipatedColumnIndex >= 0 && anticipatedColumnIndex <= Columns.Count); 5011if (dataGridViewColumn.DisplayIndex == -1 || dataGridViewColumn.DisplayIndex > Columns.Count) 5017Debug.Assert(dataGridViewColumn.DisplayIndex >= 0 && dataGridViewColumn.DisplayIndex <= Columns.Count); 5042while (displayIndex < Columns.Count && (dataGridViewColumnNext is null || !dataGridViewColumnNext.Visible)); 5152int colCount = Columns.Count, displayIndex; 5197for (int columnIndex = dataGridViewColumn.Index; columnIndex < Columns.Count; columnIndex++) 5208for (int columnIndex = dataGridViewColumn.Index + insertionCount; columnIndex < Columns.Count; columnIndex++) 5589for (int i = 0; i < Columns.Count; i++) 5809if (dgvcme.ColumnIndex < Columns.Count && dgvcme.RowIndex < Rows.Count) 5820if (e.Button == MouseButtons.Left && dgvcme.ColumnIndex < Columns.Count && dgvcme.RowIndex < Rows.Count) 5834if (dgvcme.ColumnIndex < Columns.Count && dgvcme.RowIndex < Rows.Count) 5881if (e.Button == MouseButtons.Left && dgvcme.ColumnIndex < Columns.Count && dgvcme.RowIndex < Rows.Count) 5889if (e.Button == MouseButtons.Left && dgvcme.ColumnIndex < Columns.Count && dgvcme.RowIndex < Rows.Count) 5897if (dgvcme.ColumnIndex < Columns.Count && dgvcme.RowIndex < Rows.Count) 5905if (dgvcme.ColumnIndex < Columns.Count && dgvcme.RowIndex < Rows.Count) 5913if (dgvcme.ColumnIndex < Columns.Count && dgvcme.RowIndex < Rows.Count) 6705&& columnIndexTmp < Columns.Count 6726&& columnIndexTmp < Columns.Count 6749dataGridViewColumnTmp = Columns[Columns.Count - 1]; 6762for (columnIndexTmp = 0; columnIndexTmp < Columns.Count; columnIndexTmp++) 6879return cellCount + _selectedBandIndexes.Count * Columns.Count; 6948return Rows.Count * Columns.Count; 7053ArgumentOutOfRangeException.ThrowIfGreaterThanOrEqual(columnIndex, Columns.Count); 7108Debug.Assert(columnIndex >= -1 && columnIndex < Columns.Count); 8199ArgumentOutOfRangeException.ThrowIfGreaterThanOrEqual(columnIndex, Columns.Count); 8206Debug.Assert(columnIndex >= 0 && columnIndex < Columns.Count); 8456Debug.Assert(index < Columns.Count); 9785ArgumentOutOfRangeException.ThrowIfGreaterThanOrEqual(columnIndex, Columns.Count); 9811ArgumentOutOfRangeException.ThrowIfGreaterThanOrEqual(columnIndex, Columns.Count); 9818Debug.Assert(columnIndex >= 0 && columnIndex < Columns.Count); 10042return columnIndex >= Columns.Count || columnIndex == -1; 10047return columnIndex >= Columns.Count || rowIndex >= Rows.Count || columnIndex == -1 || rowIndex == -1; 10539if (dataGridViewColumn.DisplayIndex == -1 || dataGridViewColumn.DisplayIndex >= Columns.Count) 10788CorrectColumnFrozenState(dataGridViewColumn, Columns.Count); 10806int newColumnCount = Columns.Count + 1; 10813if (dataGridViewRow.Cells.Count < newColumnCount) 10835if (dataGridViewRow.Cells.Count == newColumnCount) 10841Debug.Assert(dataGridViewRow.Cells.Count < newColumnCount); 10953int previousColumnCount = Columns.Count; 10965if (dataGridViewRow.Cells.Count < previousColumnCount + addedColumnCount) 10986while (dataGridViewRow.Cells.Count > previousColumnCount) 10988dataGridViewRow.Cells.RemoveAtInternal(dataGridViewRow.Cells.Count - 1); 11057if (dataGridViewRow.Cells.Count > Columns.Count) 11241if (previousModes.Length != Columns.Count) 11514ArgumentOutOfRangeException.ThrowIfGreaterThanOrEqual(e.ColumnIndex, Columns.Count, "e.ColumnIndex"); 11738Debug.Assert(rowIndex < Rows.Count && columnIndex < Columns.Count); 11826Debug.Assert(rowIndex < Rows.Count && columnIndex < Columns.Count); 12091if (hti._col >= Columns.Count) 12684&& _ptMouseDownCell.X < Columns.Count) 13062Debug.Assert(rowIndex < Rows.Count && columnIndex < Columns.Count); 13108Debug.Assert(rowIndex < Rows.Count && columnIndex < Columns.Count); 13268for (int i = 0; i < Columns.Count; i++) 13283if (Columns.Count != 0 && Rows.Count == 0) 13466if (!e.Handled && e.Button == MouseButtons.Left && e.ColumnIndex < Columns.Count) 13540Debug.Assert(columnIndex >= 0 && columnIndex < Columns.Count); 15441int newColumnCount = Columns.Count + 1; 15448if (dataGridViewRow.Cells.Count < newColumnCount) 15469if (dataGridViewRow.Cells.Count == newColumnCount) 15475Debug.Assert(dataGridViewRow.Cells.Count < newColumnCount); 15903if (dgvcme.ColumnIndex < Columns.Count && dgvcme.RowIndex < Rows.Count) 15924if (dgvcme.ColumnIndex < Columns.Count && dgvcme.RowIndex < Rows.Count) 15935if (dgvcme.ColumnIndex < Columns.Count && dgvcme.RowIndex < Rows.Count) 15992if (dgvcme.ColumnIndex < Columns.Count && dgvcme.RowIndex < Rows.Count) 16004if (columnIndex < Columns.Count) 16042if (dgvcme.ColumnIndex < Columns.Count && dgvcme.RowIndex < Rows.Count) 16165if (_ptMouseEnteredCell.X >= -1 && _ptMouseEnteredCell.X < Columns.Count 16388if (dgvcme.ColumnIndex < Columns.Count && dgvcme.RowIndex < Rows.Count) 17032Debug.Assert(dataGridViewColumn.Index >= 0 && dataGridViewColumn.Index < Columns.Count); 17110if (Columns.Count == 1) 17117int newColumnCount = Columns.Count - 1; 17122if (dataGridViewRow.Cells.Count > newColumnCount) 17146for (int i = 0; i < Columns.Count; i++) 17543&& Columns.Count != 0 17668if (rowIndex < Rows.Count && columnIndex < Columns.Count) 17734Debug.Assert(rowIndex < Rows.Count && columnIndex < Columns.Count); 18329if (rowIndex < Rows.Count && columnIndex < Columns.Count) 18341Debug.Assert(rowIndex < Rows.Count && columnIndex < Columns.Count); 18741if (dataGridViewCell is not null && rowIndex < Rows.Count && columnIndex < Columns.Count) 18788Debug.Assert(rowIndex < Rows.Count && columnIndex < Columns.Count); 18959for (int i = 0; i < Columns.Count; i++) 19240if (Columns.Count > 0) 19505if (Columns.Count > 0 || Rows.Count > 0) 25337if (Columns.Count > 0 && NewRowIndex == -1) 25447for (int j = 0; j < dataGridViewCols.Count; j++) 25543if (DataConnection is not null && Columns.Count > 0) 26012Debug.Assert(columnIndex >= 0 && columnIndex < Columns.Count); 26211Debug.Assert(columnIndex >= 0 && columnIndex < Columns.Count); 26212Debug.Assert(DisplayedBandsInfo.FirstDisplayedScrollingCol >= -1 && DisplayedBandsInfo.FirstDisplayedScrollingCol < Columns.Count); 26213Debug.Assert(DisplayedBandsInfo.LastTotallyDisplayedScrollingCol >= -1 && DisplayedBandsInfo.LastTotallyDisplayedScrollingCol < Columns.Count); 26564int maxColumnIndex = Columns.Count; 26604int columnIndex = 0, maxColumnIndex = Columns.Count; 26697if (index >= Columns.Count) 26699index -= Columns.Count; 26756ArgumentOutOfRangeException.ThrowIfGreaterThanOrEqual(columnIndex, Columns.Count); 26793Debug.Assert(rowIndex >= 0 && columnIndex < Columns.Count && rowIndex < Rows.Count); 26960if (oldCurrentCellX < Columns.Count && oldCurrentCellY < Rows.Count) 27123if (oldCurrentCellX < Columns.Count && oldCurrentCellY < Rows.Count) 27479Debug.Assert(columnIndex >= 0 && rowIndex >= 0 && columnIndex < Columns.Count && rowIndex < Rows.Count); 27533for (int column = columnIndex + 1; column < Columns.Count; column++) 27552Debug.Assert(columnIndex >= 0 && columnIndex < Columns.Count); 27626ArgumentOutOfRangeException.ThrowIfGreaterThanOrEqual(columnIndex, Columns.Count); 27695if (Columns.Count > BulkPaintThreshold) 27713for (int column = columnIndex + 1; column < Columns.Count; column++) 27956ArgumentOutOfRangeException.ThrowIfGreaterThanOrEqual(columnIndex, Columns.Count); 28870ArgumentOutOfRangeException.ThrowIfGreaterThanOrEqual(columnIndex, Columns.Count); 28882ArgumentOutOfRangeException.ThrowIfGreaterThanOrEqual(columnIndex, Columns.Count); 29176&& _ptMouseEnteredCell.X < Columns.Count 29203&& _ptMouseEnteredCell.X < Columns.Count
System\Windows\Forms\Controls\DataGridView\DataGridViewButtonCell.cs (1)
485ColumnIndex < DataGridView.Columns.Count &&
System\Windows\Forms\Controls\DataGridView\DataGridViewCell.cs (5)
320if (j < 0 || j > DataGridView.Columns.Count - 1 1735Debug.Assert(ColumnIndex < DataGridView.Columns.Count); 1885Debug.Assert(ColumnIndex < DataGridView.Columns.Count); 2423Debug.Assert(ColumnIndex < dataGridView.Columns.Count); 3045if (DataGridView is not null && e.ColumnIndex < DataGridView.Columns.Count && e.RowIndex < DataGridView.Rows.Count)
System\Windows\Forms\Controls\DataGridView\DataGridViewCellCollection.cs (2)
178if (dataGridView is not null && dataGridView.Columns.Count > index) 290if (dataGridView is not null && dataGridView.Columns.Count > index)
System\Windows\Forms\Controls\DataGridView\DataGridViewCellPaintingEventArgs.cs (3)
85if (ColumnIndex < -1 || ColumnIndex >= _dataGridView.Columns.Count) 114if (ColumnIndex < -1 || ColumnIndex >= _dataGridView.Columns.Count) 149if (ColumnIndex < -1 || ColumnIndex >= _dataGridView.Columns.Count)
System\Windows\Forms\Controls\DataGridView\DataGridViewCheckBoxCell.cs (2)
833ColumnIndex < DataGridView.Columns.Count && 971Debug.Assert((columnIndex >= 0) && (columnIndex < DataGridView.Columns.Count));
System\Windows\Forms\Controls\DataGridView\DataGridViewColumn.cs (1)
253if (value >= DataGridView.Columns.Count)
System\Windows\Forms\Controls\DataGridView\DataGridViewColumnCollection.cs (6)
267if (Count > 0) 281for (int columnIndex = 0; columnIndex < Count; columnIndex++) 396for (int i = 0; i < Count; i++) 504_lastAccessedSortedIndex < Count); 1034ArgumentOutOfRangeException.ThrowIfGreaterThanOrEqual(index, Count); 1058Debug.Assert(index >= 0 && index < Count);
System\Windows\Forms\Controls\DataGridView\DataGridViewLinkCell.cs (1)
735ColumnIndex < DataGridView.Columns.Count &&
System\Windows\Forms\Controls\DataGridView\DataGridViewRow.cs (5)
1073int cellsCount = rowTemplate.Cells.Count; 1125Debug.Assert(Cells.Count == dataGridView.Columns.Count); 1793int cellCount = cells.Count; 1794for (int columnIndex = 0; columnIndex < cells.Count; columnIndex++)
System\Windows\Forms\Controls\DataGridView\DataGridViewRow.DataGridViewRowAccessibleObject.cs (2)
181for (int i = 0; i < _owningDataGridViewRow.Cells.Count; i++) 418if (_owningDataGridViewRow.Cells.Count > 0)
System\Windows\Forms\Controls\DataGridView\DataGridViewRowCollection.cs (37)
194if (DataGridView.Columns.Count == 0) 199if (DataGridView.RowTemplate.Cells.Count > DataGridView.Columns.Count) 205Debug.Assert(dataGridViewRow.Cells.Count == DataGridView.Columns.Count); 300if (DataGridView.Columns.Count == 0) 328if (DataGridView.Columns.Count == 0) 343if (DataGridView.RowTemplate.Cells.Count > DataGridView.Columns.Count) 349Debug.Assert(rowTemplate.Cells.Count == DataGridView.Columns.Count); 391if (DataGridView.Columns.Count == 0) 396if (dataGridViewRow.Cells.Count > DataGridView.Columns.Count) 416Debug.Assert(dataGridViewRow.Cells.Count == DataGridView.Columns.Count); 736if (DataGridView.Columns.Count == 0) 748Debug.Assert(dataGridViewRow.Cells.Count == DataGridView.Columns.Count); 831DataGridView.Columns.Count != 0 && 1412if (DataGridView.Columns.Count == 0) 1417if (DataGridView.RowTemplate.Cells.Count > DataGridView.Columns.Count) 1430Debug.Assert(rowTemplate.Cells.Count == DataGridView.Columns.Count); 1474if (DataGridView.Columns.Count == 0) 1479if (dataGridViewRow.Cells.Count > DataGridView.Columns.Count) 1506if (DataGridView.Columns.Count == 0) 1511if (dataGridViewRow.Cells.Count > DataGridView.Columns.Count) 1518Debug.Assert(dataGridViewRow.Cells.Count == DataGridView.Columns.Count); 1781if (DataGridView.Columns.Count == 0) 1794Debug.Assert(dataGridViewRow.Cells.Count == DataGridView.Columns.Count); 2401int columnCount = DataGridView.Columns.Count;
System.Windows.Forms.Design (23)
System\Windows\Forms\Design\DataGridViewAddColumnDialog.cs (5)
85bool forceColumnFrozen = _dataGridViewColumns.Count > _insertAtPosition && _dataGridViewColumns[_insertAtPosition].Frozen; 527DataGridViewColumn[] cols = new DataGridViewColumn[_liveDataGridView.Columns.Count - _initialDataGridViewColumnsCount]; 528for (int i = _initialDataGridViewColumnsCount; i < _liveDataGridView.Columns.Count; i++) 533for (int i = _initialDataGridViewColumnsCount; i < _liveDataGridView.Columns.Count;) 806_initialDataGridViewColumnsCount = _liveDataGridView.Columns.Count;
System\Windows\Forms\Design\DataGridViewColumnCollectionDialog.cs (10)
198DataGridViewColumn[] oldColumns = new DataGridViewColumn[_liveDataGridView.Columns.Count]; 219DataGridViewColumn[] newColumns = new DataGridViewColumn[_columnsPrivateCopy.Count]; 220bool[] userAddedColumnsInfo = new bool[_columnsPrivateCopy.Count]; 221string?[] compNames = new string?[_columnsPrivateCopy.Count]; 222for (int i = 0; i < _columnsPrivateCopy.Count; i++) 437for (int i = 0; i < _columnsPrivateCopy.Count; i++) 875for (int i = 0; i < _columnsPrivateCopy.Count; i++) 1108_columnsNames.EnsureCapacity(_columnsPrivateCopy.Count); 1112_userAddedColumns.EnsureCapacity(_liveDataGridView.Columns.Count); 1121for (int i = 0; i < _liveDataGridView.Columns.Count; i++)
System\Windows\Forms\Design\DataGridViewDesigner.cs (8)
45for (int i = 0; i < dataGridView.Columns.Count; i++) 52for (int i = 0; i < dataGridView.Columns.Count; i++) 342for (int i = 0; i < dataGridView.Columns.Count; i++) 404for (int i = 0; i < dataGridView.Columns.Count; i++) 463for (int i = 0; i < dataGridView.Columns.Count;) 584DataGridViewColumn[] removeColumns = new DataGridViewColumn[dataGridView.Columns.Count]; 586for (int i = 0; i < dataGridView.Columns.Count; i++) 777dialog.Start(Control.Columns.Count, persistChangesToDesigner: true);
System.Windows.Forms.Tests (13)
System\Windows\Forms\AccessibleObjects\DataGridViewAccessibleObjectTests.cs (4)
230for (int j = 0; j < dataGridView.Rows[i].Cells.Count; j++) 1312int columnCount = dataGridView.Columns.Count; 1343int columnCount = dataGridView.Columns.Count; 1386int columnCount = dataGridView.Columns.Count;
System\Windows\Forms\BaseCollectionTests.cs (2)
14Assert.Throws<NullReferenceException>(() => collection.Count); 25Assert.Equal(3, collection.Count);
System\Windows\Forms\DataGridViewSelectedCellCollectionTests.cs (1)
35Assert.Equal(2, collection.Count);
System\Windows\Forms\DataGridViewSelectedColumnCollectionTests.cs (1)
39Assert.Equal(2, collection.Count);
System\Windows\Forms\DataGridViewSelectedRowCollectionTests.cs (1)
34Assert.Equal(2, collection.Count);
System\Windows\Forms\DataGridViewTests.cs (4)
2811Assert.Equal(2, control.Columns.Count); 2852Assert.Equal(2, control.Columns.Count); 2858Assert.Equal(2, control.Columns.Count); 2866Assert.Equal(2, control.Columns.Count);