Implemented interface member:
1 override of Count
System.Windows.Forms (1)
System\Windows\Forms\DataBinding\BindingsCollection.cs (1)
23public override int Count => _list.Count;
270 references to Count
PresentationUI (4)
MS\Internal\Documents\RMPublishingDialog.cs (1)
560if (rightsTable.SelectedRows.Count == 1)
MS\Internal\Documents\RMPublishingDialog.RightsTable.cs (3)
171if (this.SelectedRows.Count == 1) 501(e.ColumnIndex > 0) && (e.ColumnIndex < Columns.Count)) 790for (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); 2305&& firstDisplayedCell.ColumnIndex < Columns.Count); 2446ArgumentOutOfRangeException.ThrowIfGreaterThanOrEqual(value, Columns.Count); 3090for (int columnIndex = 0; columnIndex < Columns.Count; columnIndex++) 3110for (int columnIndex = 0; columnIndex < Columns.Count; columnIndex++) 3208if (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)
22if (cellAddress.X < 0 || cellAddress.X >= Columns.Count) 369Debug.Assert(columnIndex >= -1 && columnIndex < Columns.Count); 911autoFillColumns ??= new(Columns.Count); 1380if (Columns.Count == 0 && Rows.Count == 0) 1398allCellsSelected = _individualSelectedCells.Count == Columns.Count * Rows.Count; 1432allCellsSelected = _selectedBandIndexes.Count * Rows.Count + _individualSelectedCells.Count == Columns.Count * Rows.Count; 1468allCellsSelected = _selectedBandIndexes.Count * Columns.Count + _individualSelectedCells.Count == Columns.Count * Rows.Count; 1524DataGridViewColumn[] clonedColumns = new DataGridViewColumn[dataGridViewCols.Count]; 1540for (i = 0; i < dataGridViewCols.Count; i++) 1563while (i < dataGridViewCols.Count) 1714ArgumentOutOfRangeException.ThrowIfGreaterThanOrEqual(columnIndex, Columns.Count); 1764int columnsCount = Columns.Count; 1800ArgumentOutOfRangeException.ThrowIfGreaterThanOrEqual(columnIndex, Columns.Count); 1829int columnsCount = Columns.Count; 1869Debug.Assert(columnIndex >= 0 && columnIndex < Columns.Count); 1934for (int columnIndex = 0; columnIndex < Columns.Count; columnIndex++) 2578Debug.Assert(_ptCurrentCell.X >= 0 && _ptCurrentCell.X < Columns.Count); 3139if (Columns.Count > oldCurrentCellX && Columns[oldCurrentCellX].Visible) 3463ArgumentOutOfRangeException.ThrowIfGreaterThanOrEqual(columnIndexException, Columns.Count); 3472ArgumentOutOfRangeException.ThrowIfGreaterThanOrEqual(columnIndexException, Columns.Count); 3594Debug.Assert(columnIndex >= 0 && columnIndex < Columns.Count, $"Invalid columnIndex: {columnIndex}"); 4145Debug.Assert(columnIndex < Columns.Count); 4187int cellsInCollection = dataGridViewRow.Cells.Count; 4188if (Columns.Count > cellsInCollection) 4191DataGridViewCell[] cells = new DataGridViewCell[Columns.Count - cellsInCollection]; 4192for (int columnIndex = cellsInCollection; columnIndex < Columns.Count; columnIndex++) 5005Debug.Assert(anticipatedColumnIndex >= 0 && anticipatedColumnIndex <= Columns.Count); 5008if (dataGridViewColumn.DisplayIndex == -1 || dataGridViewColumn.DisplayIndex > Columns.Count) 5014Debug.Assert(dataGridViewColumn.DisplayIndex >= 0 && dataGridViewColumn.DisplayIndex <= Columns.Count); 5039while (displayIndex < Columns.Count && (dataGridViewColumnNext is null || !dataGridViewColumnNext.Visible)); 5149int colCount = Columns.Count, displayIndex; 5194for (int columnIndex = dataGridViewColumn.Index; columnIndex < Columns.Count; columnIndex++) 5205for (int columnIndex = dataGridViewColumn.Index + insertionCount; columnIndex < Columns.Count; columnIndex++) 5586for (int i = 0; i < Columns.Count; i++) 5806if (dgvcme.ColumnIndex < Columns.Count && dgvcme.RowIndex < Rows.Count) 5817if (e.Button == MouseButtons.Left && dgvcme.ColumnIndex < Columns.Count && dgvcme.RowIndex < Rows.Count) 5831if (dgvcme.ColumnIndex < Columns.Count && dgvcme.RowIndex < Rows.Count) 5878if (e.Button == MouseButtons.Left && dgvcme.ColumnIndex < Columns.Count && dgvcme.RowIndex < Rows.Count) 5886if (e.Button == MouseButtons.Left && dgvcme.ColumnIndex < Columns.Count && dgvcme.RowIndex < Rows.Count) 5894if (dgvcme.ColumnIndex < Columns.Count && dgvcme.RowIndex < Rows.Count) 5902if (dgvcme.ColumnIndex < Columns.Count && dgvcme.RowIndex < Rows.Count) 5910if (dgvcme.ColumnIndex < Columns.Count && dgvcme.RowIndex < Rows.Count) 6702&& columnIndexTmp < Columns.Count 6723&& columnIndexTmp < Columns.Count 6746dataGridViewColumnTmp = Columns[Columns.Count - 1]; 6759for (columnIndexTmp = 0; columnIndexTmp < Columns.Count; columnIndexTmp++) 6876return cellCount + _selectedBandIndexes.Count * Columns.Count; 6945return Rows.Count * Columns.Count; 7050ArgumentOutOfRangeException.ThrowIfGreaterThanOrEqual(columnIndex, Columns.Count); 7105Debug.Assert(columnIndex >= -1 && columnIndex < Columns.Count); 8196ArgumentOutOfRangeException.ThrowIfGreaterThanOrEqual(columnIndex, Columns.Count); 8203Debug.Assert(columnIndex >= 0 && columnIndex < Columns.Count); 8453Debug.Assert(index < Columns.Count); 9782ArgumentOutOfRangeException.ThrowIfGreaterThanOrEqual(columnIndex, Columns.Count); 9808ArgumentOutOfRangeException.ThrowIfGreaterThanOrEqual(columnIndex, Columns.Count); 9815Debug.Assert(columnIndex >= 0 && columnIndex < Columns.Count); 10039return columnIndex >= Columns.Count || columnIndex == -1; 10044return columnIndex >= Columns.Count || rowIndex >= Rows.Count || columnIndex == -1 || rowIndex == -1; 10536if (dataGridViewColumn.DisplayIndex == -1 || dataGridViewColumn.DisplayIndex >= Columns.Count) 10785CorrectColumnFrozenState(dataGridViewColumn, Columns.Count); 10803int newColumnCount = Columns.Count + 1; 10810if (dataGridViewRow.Cells.Count < newColumnCount) 10832if (dataGridViewRow.Cells.Count == newColumnCount) 10838Debug.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"); 11735Debug.Assert(rowIndex < Rows.Count && columnIndex < Columns.Count); 11823Debug.Assert(rowIndex < Rows.Count && columnIndex < Columns.Count); 12088if (hti._col >= Columns.Count) 12681&& _ptMouseDownCell.X < Columns.Count) 13059Debug.Assert(rowIndex < Rows.Count && columnIndex < Columns.Count); 13105Debug.Assert(rowIndex < Rows.Count && columnIndex < Columns.Count); 13265for (int i = 0; i < Columns.Count; i++) 13280if (Columns.Count != 0 && Rows.Count == 0) 13463if (!e.Handled && e.Button == MouseButtons.Left && e.ColumnIndex < Columns.Count) 13537Debug.Assert(columnIndex >= 0 && columnIndex < Columns.Count); 15438int newColumnCount = Columns.Count + 1; 15445if (dataGridViewRow.Cells.Count < newColumnCount) 15466if (dataGridViewRow.Cells.Count == newColumnCount) 15472Debug.Assert(dataGridViewRow.Cells.Count < newColumnCount); 15900if (dgvcme.ColumnIndex < Columns.Count && dgvcme.RowIndex < Rows.Count) 15921if (dgvcme.ColumnIndex < Columns.Count && dgvcme.RowIndex < Rows.Count) 15932if (dgvcme.ColumnIndex < Columns.Count && dgvcme.RowIndex < Rows.Count) 15989if (dgvcme.ColumnIndex < Columns.Count && dgvcme.RowIndex < Rows.Count) 16001if (columnIndex < Columns.Count) 16039if (dgvcme.ColumnIndex < Columns.Count && dgvcme.RowIndex < Rows.Count) 16162if (_ptMouseEnteredCell.X >= -1 && _ptMouseEnteredCell.X < Columns.Count 16385if (dgvcme.ColumnIndex < Columns.Count && dgvcme.RowIndex < Rows.Count) 17026Debug.Assert(dataGridViewColumn.Index >= 0 && dataGridViewColumn.Index < Columns.Count); 17104if (Columns.Count == 1) 17111int newColumnCount = Columns.Count - 1; 17116if (dataGridViewRow.Cells.Count > newColumnCount) 17140for (int i = 0; i < Columns.Count; i++) 17537&& Columns.Count != 0 17662if (rowIndex < Rows.Count && columnIndex < Columns.Count) 17728Debug.Assert(rowIndex < Rows.Count && columnIndex < Columns.Count); 18323if (rowIndex < Rows.Count && columnIndex < Columns.Count) 18335Debug.Assert(rowIndex < Rows.Count && columnIndex < Columns.Count); 18735if (dataGridViewCell is not null && rowIndex < Rows.Count && columnIndex < Columns.Count) 18782Debug.Assert(rowIndex < Rows.Count && columnIndex < Columns.Count); 18953for (int i = 0; i < Columns.Count; i++) 19234if (Columns.Count > 0) 19499if (Columns.Count > 0 || Rows.Count > 0) 25328if (Columns.Count > 0 && NewRowIndex == -1) 25438for (int j = 0; j < dataGridViewCols.Count; j++) 25534if (DataConnection is not null && Columns.Count > 0) 26003Debug.Assert(columnIndex >= 0 && columnIndex < Columns.Count); 26202Debug.Assert(columnIndex >= 0 && columnIndex < Columns.Count); 26203Debug.Assert(DisplayedBandsInfo.FirstDisplayedScrollingCol >= -1 && DisplayedBandsInfo.FirstDisplayedScrollingCol < Columns.Count); 26204Debug.Assert(DisplayedBandsInfo.LastTotallyDisplayedScrollingCol >= -1 && DisplayedBandsInfo.LastTotallyDisplayedScrollingCol < Columns.Count); 26555int maxColumnIndex = Columns.Count; 26595int columnIndex = 0, maxColumnIndex = Columns.Count; 26688if (index >= Columns.Count) 26690index -= Columns.Count; 26747ArgumentOutOfRangeException.ThrowIfGreaterThanOrEqual(columnIndex, Columns.Count); 26784Debug.Assert(rowIndex >= 0 && columnIndex < Columns.Count && rowIndex < Rows.Count); 26951if (oldCurrentCellX < Columns.Count && oldCurrentCellY < Rows.Count) 27115if (oldCurrentCellX < Columns.Count && oldCurrentCellY < Rows.Count) 27471Debug.Assert(columnIndex >= 0 && rowIndex >= 0 && columnIndex < Columns.Count && rowIndex < Rows.Count); 27525for (int column = columnIndex + 1; column < Columns.Count; column++) 27544Debug.Assert(columnIndex >= 0 && columnIndex < Columns.Count); 27618ArgumentOutOfRangeException.ThrowIfGreaterThanOrEqual(columnIndex, Columns.Count); 27687if (Columns.Count > BulkPaintThreshold) 27705for (int column = columnIndex + 1; column < Columns.Count; column++) 27948ArgumentOutOfRangeException.ThrowIfGreaterThanOrEqual(columnIndex, Columns.Count); 28862ArgumentOutOfRangeException.ThrowIfGreaterThanOrEqual(columnIndex, Columns.Count); 28874ArgumentOutOfRangeException.ThrowIfGreaterThanOrEqual(columnIndex, Columns.Count); 29168&& _ptMouseEnteredCell.X < Columns.Count 29195&& _ptMouseEnteredCell.X < Columns.Count
System\Windows\Forms\Controls\DataGridView\DataGridViewButtonCell.cs (1)
482ColumnIndex < 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 && 971columnIndex < 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)
732ColumnIndex < DataGridView.Columns.Count &&
System\Windows\Forms\Controls\DataGridView\DataGridViewRow.cs (5)
1077int cellsCount = rowTemplate.Cells.Count; 1129Debug.Assert(Cells.Count == dataGridView.Columns.Count); 1797int cellCount = cells.Count; 1798for (int columnIndex = 0; columnIndex < cells.Count; columnIndex++)
System\Windows\Forms\Controls\DataGridView\DataGridViewRow.DataGridViewRowAccessibleObject.cs (2)
180for (int i = 0; i < _owningDataGridViewRow.Cells.Count; i++) 417if (_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)
44for (int i = 0; i < dataGridView.Columns.Count; i++) 51for (int i = 0; i < dataGridView.Columns.Count; i++) 341for (int i = 0; i < dataGridView.Columns.Count; i++) 403for (int i = 0; i < dataGridView.Columns.Count; i++) 462for (int i = 0; i < dataGridView.Columns.Count;) 583DataGridViewColumn[] removeColumns = new DataGridViewColumn[dataGridView.Columns.Count]; 585for (int i = 0; i < dataGridView.Columns.Count; i++) 776dialog.Start(Control.Columns.Count, persistChangesToDesigner: true);
System.Windows.Forms.Design.Tests (2)
System\Windows\Forms\Design\DataGridViewDesignerTests.cs (2)
65Times.Exactly(_dataGridView.Columns.Count) 75Times.Exactly(_dataGridView.Columns.Count)
System.Windows.Forms.Tests (13)
System\Windows\Forms\AccessibleObjects\DataGridViewAccessibleObjectTests.cs (4)
232for (int j = 0; j < dataGridView.Rows[i].Cells.Count; j++) 1314int columnCount = dataGridView.Columns.Count; 1345int columnCount = dataGridView.Columns.Count; 1388int columnCount = dataGridView.Columns.Count;
System\Windows\Forms\BaseCollectionTests.cs (2)
16Assert.Throws<NullReferenceException>(() => collection.Count); 27Assert.Equal(3, collection.Count);
System\Windows\Forms\DataGridViewSelectedCellCollectionTests.cs (1)
37Assert.Equal(2, collection.Count);
System\Windows\Forms\DataGridViewSelectedColumnCollectionTests.cs (1)
41Assert.Equal(2, collection.Count);
System\Windows\Forms\DataGridViewSelectedRowCollectionTests.cs (1)
36Assert.Equal(2, collection.Count);
System\Windows\Forms\DataGridViewTests.cs (4)
2813Assert.Equal(2, control.Columns.Count); 2854Assert.Equal(2, control.Columns.Count); 2860Assert.Equal(2, control.Columns.Count); 2868Assert.Equal(2, control.Columns.Count);