Implemented interface member:
1 override of Count
System.Windows.Forms (1)
System\Windows\Forms\DataBinding\BindingsCollection.cs (1)
23public override int Count => _list.Count;
272 references to Count
PresentationUI (4)
MS\Internal\Documents\RMPublishingDialog.cs (1)
569if (rightsTable.SelectedRows.Count == 1)
MS\Internal\Documents\RMPublishingDialog.RightsTable.cs (3)
174if (this.SelectedRows.Count == 1) 497(e.ColumnIndex > 0) && (e.ColumnIndex < Columns.Count)) 786for (int i = RightsTableColumnToIndex(_leftModifiablePermissionColumn); i < Columns.Count - 1; i++)
System.Windows.Forms (228)
System\Windows\Forms\Controls\DataGridView\DataGridView.AccessibleObject.cs (2)
65if (owner.Columns.Count == 0) 114if (!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); 8198ArgumentOutOfRangeException.ThrowIfGreaterThanOrEqual(columnIndex, Columns.Count); 8205Debug.Assert(columnIndex >= 0 && columnIndex < Columns.Count); 8455Debug.Assert(index < Columns.Count); 9784ArgumentOutOfRangeException.ThrowIfGreaterThanOrEqual(columnIndex, Columns.Count); 9810ArgumentOutOfRangeException.ThrowIfGreaterThanOrEqual(columnIndex, Columns.Count); 9817Debug.Assert(columnIndex >= 0 && columnIndex < Columns.Count); 10041return columnIndex >= Columns.Count || columnIndex == -1; 10046return columnIndex >= Columns.Count || rowIndex >= Rows.Count || columnIndex == -1 || rowIndex == -1; 10538if (dataGridViewColumn.DisplayIndex == -1 || dataGridViewColumn.DisplayIndex >= Columns.Count) 10787CorrectColumnFrozenState(dataGridViewColumn, Columns.Count); 10804int newColumnCount = Columns.Count + 1; 10811if (dataGridViewRow.Cells.Count < newColumnCount) 10833if (dataGridViewRow.Cells.Count == newColumnCount) 10839Debug.Assert(dataGridViewRow.Cells.Count < newColumnCount); 10950int previousColumnCount = Columns.Count; 10962if (dataGridViewRow.Cells.Count < previousColumnCount + addedColumnCount) 10983while (dataGridViewRow.Cells.Count > previousColumnCount) 10985dataGridViewRow.Cells.RemoveAtInternal(dataGridViewRow.Cells.Count - 1); 11054if (dataGridViewRow.Cells.Count > Columns.Count) 11238if (previousModes.Length != Columns.Count) 11511ArgumentOutOfRangeException.ThrowIfGreaterThanOrEqual(e.ColumnIndex, Columns.Count, "e.ColumnIndex"); 11731Debug.Assert(rowIndex < Rows.Count && columnIndex < Columns.Count); 11819Debug.Assert(rowIndex < Rows.Count && columnIndex < Columns.Count); 12081if (hti._col >= Columns.Count) 12671&& _ptMouseDownCell.X < Columns.Count) 13048Debug.Assert(rowIndex < Rows.Count && columnIndex < Columns.Count); 13094Debug.Assert(rowIndex < Rows.Count && columnIndex < Columns.Count); 13254for (int i = 0; i < Columns.Count; i++) 13269if (Columns.Count != 0 && Rows.Count == 0) 13452if (!e.Handled && e.Button == MouseButtons.Left && e.ColumnIndex < Columns.Count) 13526Debug.Assert(columnIndex >= 0 && columnIndex < Columns.Count); 15425int newColumnCount = Columns.Count + 1; 15432if (dataGridViewRow.Cells.Count < newColumnCount) 15453if (dataGridViewRow.Cells.Count == newColumnCount) 15459Debug.Assert(dataGridViewRow.Cells.Count < newColumnCount); 15884if (dgvcme.ColumnIndex < Columns.Count && dgvcme.RowIndex < Rows.Count) 15905if (dgvcme.ColumnIndex < Columns.Count && dgvcme.RowIndex < Rows.Count) 15916if (dgvcme.ColumnIndex < Columns.Count && dgvcme.RowIndex < Rows.Count) 15973if (dgvcme.ColumnIndex < Columns.Count && dgvcme.RowIndex < Rows.Count) 15985if (columnIndex < Columns.Count) 16023if (dgvcme.ColumnIndex < Columns.Count && dgvcme.RowIndex < Rows.Count) 16146if (_ptMouseEnteredCell.X >= -1 && _ptMouseEnteredCell.X < Columns.Count 16369if (dgvcme.ColumnIndex < Columns.Count && dgvcme.RowIndex < Rows.Count) 17013Debug.Assert(dataGridViewColumn.Index >= 0 && dataGridViewColumn.Index < Columns.Count); 17091if (Columns.Count == 1) 17098int newColumnCount = Columns.Count - 1; 17103if (dataGridViewRow.Cells.Count > newColumnCount) 17127for (int i = 0; i < Columns.Count; i++) 17524&& Columns.Count != 0 17649if (rowIndex < Rows.Count && columnIndex < Columns.Count) 17715Debug.Assert(rowIndex < Rows.Count && columnIndex < Columns.Count); 18310if (rowIndex < Rows.Count && columnIndex < Columns.Count) 18322Debug.Assert(rowIndex < Rows.Count && columnIndex < Columns.Count); 18722if (dataGridViewCell is not null && rowIndex < Rows.Count && columnIndex < Columns.Count) 18769Debug.Assert(rowIndex < Rows.Count && columnIndex < Columns.Count); 18940for (int i = 0; i < Columns.Count; i++) 19221if (Columns.Count > 0) 19485if (Columns.Count > 0 || Rows.Count > 0) 25317if (Columns.Count > 0 && NewRowIndex == -1) 25427for (int j = 0; j < dataGridViewCols.Count; j++) 25523if (DataConnection is not null && Columns.Count > 0) 25992Debug.Assert(columnIndex >= 0 && columnIndex < Columns.Count); 26191Debug.Assert(columnIndex >= 0 && columnIndex < Columns.Count); 26192Debug.Assert(DisplayedBandsInfo.FirstDisplayedScrollingCol >= -1 && DisplayedBandsInfo.FirstDisplayedScrollingCol < Columns.Count); 26193Debug.Assert(DisplayedBandsInfo.LastTotallyDisplayedScrollingCol >= -1 && DisplayedBandsInfo.LastTotallyDisplayedScrollingCol < Columns.Count); 26545int maxColumnIndex = Columns.Count; 26585int columnIndex = 0, maxColumnIndex = Columns.Count; 26678if (index >= Columns.Count) 26680index -= Columns.Count; 26737ArgumentOutOfRangeException.ThrowIfGreaterThanOrEqual(columnIndex, Columns.Count); 26774Debug.Assert(rowIndex >= 0 && columnIndex < Columns.Count && rowIndex < Rows.Count); 26941if (oldCurrentCellX < Columns.Count && oldCurrentCellY < Rows.Count) 27104if (oldCurrentCellX < Columns.Count && oldCurrentCellY < Rows.Count) 27460Debug.Assert(columnIndex >= 0 && rowIndex >= 0 && columnIndex < Columns.Count && rowIndex < Rows.Count); 27514for (int column = columnIndex + 1; column < Columns.Count; column++) 27533Debug.Assert(columnIndex >= 0 && columnIndex < Columns.Count); 27607ArgumentOutOfRangeException.ThrowIfGreaterThanOrEqual(columnIndex, Columns.Count); 27676if (Columns.Count > BulkPaintThreshold) 27694for (int column = columnIndex + 1; column < Columns.Count; column++) 27937ArgumentOutOfRangeException.ThrowIfGreaterThanOrEqual(columnIndex, Columns.Count); 28851ArgumentOutOfRangeException.ThrowIfGreaterThanOrEqual(columnIndex, Columns.Count); 28863ArgumentOutOfRangeException.ThrowIfGreaterThanOrEqual(columnIndex, Columns.Count); 29157&& _ptMouseEnteredCell.X < Columns.Count 29184&& _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); 3043if (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)
832ColumnIndex < DataGridView.Columns.Count && 970Debug.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)
268if (Count > 0) 282for (int columnIndex = 0; columnIndex < Count; columnIndex++) 397for (int i = 0; i < Count; i++) 505_lastAccessedSortedIndex < Count); 1035ArgumentOutOfRangeException.ThrowIfGreaterThanOrEqual(index, Count); 1059Debug.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); 1794int cellCount = cells.Count; 1795for (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)
86bool forceColumnFrozen = _dataGridViewColumns.Count > _insertAtPosition && _dataGridViewColumns[_insertAtPosition].Frozen; 528DataGridViewColumn[] cols = new DataGridViewColumn[_liveDataGridView.Columns.Count - _initialDataGridViewColumnsCount]; 529for (int i = _initialDataGridViewColumnsCount; i < _liveDataGridView.Columns.Count; i++) 534for (int i = _initialDataGridViewColumnsCount; i < _liveDataGridView.Columns.Count;) 813_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++) 439for (int i = 0; i < _columnsPrivateCopy.Count; i++) 877for (int i = 0; i < _columnsPrivateCopy.Count; i++) 1110_columnsNames.EnsureCapacity(_columnsPrivateCopy.Count); 1114_userAddedColumns.EnsureCapacity(_liveDataGridView.Columns.Count); 1123for (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 (17)
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\DataGridViewColumnCollectionTests.cs (1)
17Assert.Equal(0, collection.Count);
System\Windows\Forms\DataGridViewSelectedCellCollectionTests.cs (2)
15Assert.Equal(0, collection.Count); 35Assert.Equal(2, collection.Count);
System\Windows\Forms\DataGridViewSelectedColumnCollectionTests.cs (2)
15Assert.Equal(0, collection.Count); 39Assert.Equal(2, collection.Count);
System\Windows\Forms\DataGridViewSelectedRowCollectionTests.cs (2)
15Assert.Equal(0, collection.Count); 34Assert.Equal(2, collection.Count);
System\Windows\Forms\DataGridViewTests.cs (4)
2812Assert.Equal(2, control.Columns.Count); 2853Assert.Equal(2, control.Columns.Count); 2859Assert.Equal(2, control.Columns.Count); 2867Assert.Equal(2, control.Columns.Count);