Implemented interface member:
1 override of Count
System.Windows.Forms (1)
System\Windows\Forms\DataBinding\BindingsCollection.cs (1)
23
public override int
Count
=> _list.Count;
268 references to Count
PresentationUI (4)
MS\Internal\Documents\RMPublishingDialog.cs (1)
569
if (rightsTable.SelectedRows.
Count
== 1)
MS\Internal\Documents\RMPublishingDialog.RightsTable.cs (3)
174
if (this.SelectedRows.
Count
== 1)
497
(e.ColumnIndex > 0) && (e.ColumnIndex < Columns.
Count
))
786
for (int i = RightsTableColumnToIndex(_leftModifiablePermissionColumn); i < Columns.
Count
- 1; i++)
System.Windows.Forms (228)
System\Windows\Forms\Controls\DataGridView\DataGridView.AccessibleObject.cs (2)
65
if (owner.Columns.
Count
== 0)
114
if (!this.TryGetOwnerAs(out DataGridView? owner) || owner.Columns.
Count
== 0)
System\Windows\Forms\Controls\DataGridView\DataGridView.cs (17)
919
DataGridViewAutoSizeColumnMode[] previousModes = new DataGridViewAutoSizeColumnMode[Columns.
Count
];
1389
get => Columns.
Count
;
1399
if (value != Columns.
Count
)
1406
else if (value < Columns.
Count
)
1409
while (value < Columns.
Count
)
1411
int currentColumnCount = Columns.
Count
;
1413
if (Columns.
Count
>= currentColumnCount)
1423
while (value > Columns.
Count
)
1425
int currentColumnCount = Columns.
Count
;
1427
if (Columns.
Count
<= currentColumnCount)
1707
Debug.Assert(_ptCurrentCell.X < Columns.
Count
);
1775
Debug.Assert(_ptCurrentCell.X >= 0 && _ptCurrentCell.X < Columns.
Count
);
2304
&& firstDisplayedCell.ColumnIndex < Columns.
Count
);
2445
ArgumentOutOfRangeException.ThrowIfGreaterThanOrEqual(value, Columns.
Count
);
3089
for (int columnIndex = 0; columnIndex < Columns.
Count
; columnIndex++)
3109
for (int columnIndex = 0; columnIndex < Columns.
Count
; columnIndex++)
3207
if (Columns.
Count
== 0)
System\Windows\Forms\Controls\DataGridView\DataGridView.DataConnection.cs (8)
221
for (int i = 0; i < _owner.Columns.
Count
; i++)
237
for (int i = 0; i < _owner.Columns.
Count
; i++)
341
Debug.Assert(DataBoundRowsCount() == CurrencyManager!.List!.Count || (_owner.Columns.
Count
== 0 && dataGridViewRowsCount == 0),
433
if (_owner.Columns.
Count
> 0)
630
for (int columnIndex = 0; columnIndex < _owner.Columns.
Count
; columnIndex++)
679
if (_owner.Columns.
Count
== 0)
1199
if (_owner.Columns.
Count
== 0)
1268
|| (columnIndex < _owner.Columns.
Count
System\Windows\Forms\Controls\DataGridView\DataGridView.Methods.cs (136)
23
if (cellAddress.X < 0 || cellAddress.X >= Columns.
Count
)
370
Debug.Assert(columnIndex >= -1 && columnIndex < Columns.
Count
);
912
autoFillColumns ??= new(Columns.
Count
);
1381
if (Columns.
Count
== 0 && Rows.Count == 0)
1399
allCellsSelected = _individualSelectedCells.Count == Columns.
Count
* Rows.Count;
1433
allCellsSelected = _selectedBandIndexes.Count * Rows.Count + _individualSelectedCells.Count == Columns.
Count
* Rows.Count;
1469
allCellsSelected = _selectedBandIndexes.Count * Columns.
Count
+ _individualSelectedCells.Count == Columns.
Count
* Rows.Count;
1525
DataGridViewColumn[] clonedColumns = new DataGridViewColumn[dataGridViewCols.
Count
];
1541
for (i = 0; i < dataGridViewCols.
Count
; i++)
1564
while (i < dataGridViewCols.
Count
)
1715
ArgumentOutOfRangeException.ThrowIfGreaterThanOrEqual(columnIndex, Columns.
Count
);
1765
int columnsCount = Columns.
Count
;
1801
ArgumentOutOfRangeException.ThrowIfGreaterThanOrEqual(columnIndex, Columns.
Count
);
1830
int columnsCount = Columns.
Count
;
1870
Debug.Assert(columnIndex >= 0 && columnIndex < Columns.
Count
);
1935
for (int columnIndex = 0; columnIndex < Columns.
Count
; columnIndex++)
2579
Debug.Assert(_ptCurrentCell.X >= 0 && _ptCurrentCell.X < Columns.
Count
);
3140
if (Columns.
Count
> oldCurrentCellX && Columns[oldCurrentCellX].Visible)
3466
ArgumentOutOfRangeException.ThrowIfGreaterThanOrEqual(columnIndexException, Columns.
Count
);
3475
ArgumentOutOfRangeException.ThrowIfGreaterThanOrEqual(columnIndexException, Columns.
Count
);
3597
Debug.Assert(columnIndex >= 0 && columnIndex < Columns.
Count
, $"Invalid columnIndex: {columnIndex}");
4148
Debug.Assert(columnIndex < Columns.
Count
);
4190
int cellsInCollection = dataGridViewRow.Cells.
Count
;
4191
if (Columns.
Count
> cellsInCollection)
4194
DataGridViewCell[] cells = new DataGridViewCell[Columns.
Count
- cellsInCollection];
4195
for (int columnIndex = cellsInCollection; columnIndex < Columns.
Count
; columnIndex++)
5008
Debug.Assert(anticipatedColumnIndex >= 0 && anticipatedColumnIndex <= Columns.
Count
);
5011
if (dataGridViewColumn.DisplayIndex == -1 || dataGridViewColumn.DisplayIndex > Columns.
Count
)
5017
Debug.Assert(dataGridViewColumn.DisplayIndex >= 0 && dataGridViewColumn.DisplayIndex <= Columns.
Count
);
5042
while (displayIndex < Columns.
Count
&& (dataGridViewColumnNext is null || !dataGridViewColumnNext.Visible));
5152
int colCount = Columns.
Count
, displayIndex;
5197
for (int columnIndex = dataGridViewColumn.Index; columnIndex < Columns.
Count
; columnIndex++)
5208
for (int columnIndex = dataGridViewColumn.Index + insertionCount; columnIndex < Columns.
Count
; columnIndex++)
5589
for (int i = 0; i < Columns.
Count
; i++)
5809
if (dgvcme.ColumnIndex < Columns.
Count
&& dgvcme.RowIndex < Rows.Count)
5820
if (e.Button == MouseButtons.Left && dgvcme.ColumnIndex < Columns.
Count
&& dgvcme.RowIndex < Rows.Count)
5834
if (dgvcme.ColumnIndex < Columns.
Count
&& dgvcme.RowIndex < Rows.Count)
5881
if (e.Button == MouseButtons.Left && dgvcme.ColumnIndex < Columns.
Count
&& dgvcme.RowIndex < Rows.Count)
5889
if (e.Button == MouseButtons.Left && dgvcme.ColumnIndex < Columns.
Count
&& dgvcme.RowIndex < Rows.Count)
5897
if (dgvcme.ColumnIndex < Columns.
Count
&& dgvcme.RowIndex < Rows.Count)
5905
if (dgvcme.ColumnIndex < Columns.
Count
&& dgvcme.RowIndex < Rows.Count)
5913
if (dgvcme.ColumnIndex < Columns.
Count
&& dgvcme.RowIndex < Rows.Count)
6705
&& columnIndexTmp < Columns.
Count
6726
&& columnIndexTmp < Columns.
Count
6749
dataGridViewColumnTmp = Columns[Columns.
Count
- 1];
6762
for (columnIndexTmp = 0; columnIndexTmp < Columns.
Count
; columnIndexTmp++)
6879
return cellCount + _selectedBandIndexes.Count * Columns.
Count
;
6948
return Rows.Count * Columns.
Count
;
7053
ArgumentOutOfRangeException.ThrowIfGreaterThanOrEqual(columnIndex, Columns.
Count
);
7108
Debug.Assert(columnIndex >= -1 && columnIndex < Columns.
Count
);
8198
ArgumentOutOfRangeException.ThrowIfGreaterThanOrEqual(columnIndex, Columns.
Count
);
8205
Debug.Assert(columnIndex >= 0 && columnIndex < Columns.
Count
);
8455
Debug.Assert(index < Columns.
Count
);
9784
ArgumentOutOfRangeException.ThrowIfGreaterThanOrEqual(columnIndex, Columns.
Count
);
9810
ArgumentOutOfRangeException.ThrowIfGreaterThanOrEqual(columnIndex, Columns.
Count
);
9817
Debug.Assert(columnIndex >= 0 && columnIndex < Columns.
Count
);
10041
return columnIndex >= Columns.
Count
|| columnIndex == -1;
10046
return columnIndex >= Columns.
Count
|| rowIndex >= Rows.Count || columnIndex == -1 || rowIndex == -1;
10538
if (dataGridViewColumn.DisplayIndex == -1 || dataGridViewColumn.DisplayIndex >= Columns.
Count
)
10787
CorrectColumnFrozenState(dataGridViewColumn, Columns.
Count
);
10804
int newColumnCount = Columns.
Count
+ 1;
10811
if (dataGridViewRow.Cells.
Count
< newColumnCount)
10833
if (dataGridViewRow.Cells.
Count
== newColumnCount)
10839
Debug.Assert(dataGridViewRow.Cells.
Count
< newColumnCount);
10950
int previousColumnCount = Columns.
Count
;
10962
if (dataGridViewRow.Cells.
Count
< previousColumnCount + addedColumnCount)
10983
while (dataGridViewRow.Cells.
Count
> previousColumnCount)
10985
dataGridViewRow.Cells.RemoveAtInternal(dataGridViewRow.Cells.
Count
- 1);
11054
if (dataGridViewRow.Cells.
Count
> Columns.
Count
)
11238
if (previousModes.Length != Columns.
Count
)
11511
ArgumentOutOfRangeException.ThrowIfGreaterThanOrEqual(e.ColumnIndex, Columns.
Count
, "e.ColumnIndex");
11731
Debug.Assert(rowIndex < Rows.Count && columnIndex < Columns.
Count
);
11819
Debug.Assert(rowIndex < Rows.Count && columnIndex < Columns.
Count
);
12081
if (hti._col >= Columns.
Count
)
12671
&& _ptMouseDownCell.X < Columns.
Count
)
13048
Debug.Assert(rowIndex < Rows.Count && columnIndex < Columns.
Count
);
13094
Debug.Assert(rowIndex < Rows.Count && columnIndex < Columns.
Count
);
13254
for (int i = 0; i < Columns.
Count
; i++)
13269
if (Columns.
Count
!= 0 && Rows.Count == 0)
13452
if (!e.Handled && e.Button == MouseButtons.Left && e.ColumnIndex < Columns.
Count
)
13526
Debug.Assert(columnIndex >= 0 && columnIndex < Columns.
Count
);
15425
int newColumnCount = Columns.
Count
+ 1;
15432
if (dataGridViewRow.Cells.
Count
< newColumnCount)
15453
if (dataGridViewRow.Cells.
Count
== newColumnCount)
15459
Debug.Assert(dataGridViewRow.Cells.
Count
< newColumnCount);
15884
if (dgvcme.ColumnIndex < Columns.
Count
&& dgvcme.RowIndex < Rows.Count)
15905
if (dgvcme.ColumnIndex < Columns.
Count
&& dgvcme.RowIndex < Rows.Count)
15916
if (dgvcme.ColumnIndex < Columns.
Count
&& dgvcme.RowIndex < Rows.Count)
15973
if (dgvcme.ColumnIndex < Columns.
Count
&& dgvcme.RowIndex < Rows.Count)
15985
if (columnIndex < Columns.
Count
)
16023
if (dgvcme.ColumnIndex < Columns.
Count
&& dgvcme.RowIndex < Rows.Count)
16146
if (_ptMouseEnteredCell.X >= -1 && _ptMouseEnteredCell.X < Columns.
Count
16369
if (dgvcme.ColumnIndex < Columns.
Count
&& dgvcme.RowIndex < Rows.Count)
17013
Debug.Assert(dataGridViewColumn.Index >= 0 && dataGridViewColumn.Index < Columns.
Count
);
17091
if (Columns.
Count
== 1)
17098
int newColumnCount = Columns.
Count
- 1;
17103
if (dataGridViewRow.Cells.
Count
> newColumnCount)
17127
for (int i = 0; i < Columns.
Count
; i++)
17524
&& Columns.
Count
!= 0
17649
if (rowIndex < Rows.Count && columnIndex < Columns.
Count
)
17715
Debug.Assert(rowIndex < Rows.Count && columnIndex < Columns.
Count
);
18310
if (rowIndex < Rows.Count && columnIndex < Columns.
Count
)
18322
Debug.Assert(rowIndex < Rows.Count && columnIndex < Columns.
Count
);
18722
if (dataGridViewCell is not null && rowIndex < Rows.Count && columnIndex < Columns.
Count
)
18769
Debug.Assert(rowIndex < Rows.Count && columnIndex < Columns.
Count
);
18940
for (int i = 0; i < Columns.
Count
; i++)
19221
if (Columns.
Count
> 0)
19485
if (Columns.
Count
> 0 || Rows.Count > 0)
25317
if (Columns.
Count
> 0 && NewRowIndex == -1)
25427
for (int j = 0; j < dataGridViewCols.
Count
; j++)
25523
if (DataConnection is not null && Columns.
Count
> 0)
25992
Debug.Assert(columnIndex >= 0 && columnIndex < Columns.
Count
);
26191
Debug.Assert(columnIndex >= 0 && columnIndex < Columns.
Count
);
26192
Debug.Assert(DisplayedBandsInfo.FirstDisplayedScrollingCol >= -1 && DisplayedBandsInfo.FirstDisplayedScrollingCol < Columns.
Count
);
26193
Debug.Assert(DisplayedBandsInfo.LastTotallyDisplayedScrollingCol >= -1 && DisplayedBandsInfo.LastTotallyDisplayedScrollingCol < Columns.
Count
);
26545
int maxColumnIndex = Columns.
Count
;
26585
int columnIndex = 0, maxColumnIndex = Columns.
Count
;
26678
if (index >= Columns.
Count
)
26680
index -= Columns.
Count
;
26737
ArgumentOutOfRangeException.ThrowIfGreaterThanOrEqual(columnIndex, Columns.
Count
);
26774
Debug.Assert(rowIndex >= 0 && columnIndex < Columns.
Count
&& rowIndex < Rows.Count);
26941
if (oldCurrentCellX < Columns.
Count
&& oldCurrentCellY < Rows.Count)
27104
if (oldCurrentCellX < Columns.
Count
&& oldCurrentCellY < Rows.Count)
27460
Debug.Assert(columnIndex >= 0 && rowIndex >= 0 && columnIndex < Columns.
Count
&& rowIndex < Rows.Count);
27514
for (int column = columnIndex + 1; column < Columns.
Count
; column++)
27533
Debug.Assert(columnIndex >= 0 && columnIndex < Columns.
Count
);
27607
ArgumentOutOfRangeException.ThrowIfGreaterThanOrEqual(columnIndex, Columns.
Count
);
27676
if (Columns.
Count
> BulkPaintThreshold)
27694
for (int column = columnIndex + 1; column < Columns.
Count
; column++)
27937
ArgumentOutOfRangeException.ThrowIfGreaterThanOrEqual(columnIndex, Columns.
Count
);
28851
ArgumentOutOfRangeException.ThrowIfGreaterThanOrEqual(columnIndex, Columns.
Count
);
28863
ArgumentOutOfRangeException.ThrowIfGreaterThanOrEqual(columnIndex, Columns.
Count
);
29157
&& _ptMouseEnteredCell.X < Columns.
Count
29184
&& _ptMouseEnteredCell.X < Columns.
Count
System\Windows\Forms\Controls\DataGridView\DataGridViewButtonCell.cs (1)
485
ColumnIndex < DataGridView.Columns.
Count
&&
System\Windows\Forms\Controls\DataGridView\DataGridViewCell.cs (5)
320
if (j < 0 || j > DataGridView.Columns.
Count
- 1
1735
Debug.Assert(ColumnIndex < DataGridView.Columns.
Count
);
1885
Debug.Assert(ColumnIndex < DataGridView.Columns.
Count
);
2423
Debug.Assert(ColumnIndex < dataGridView.Columns.
Count
);
3043
if (e.ColumnIndex < DataGridView.Columns.
Count
&& e.RowIndex < DataGridView.Rows.Count)
System\Windows\Forms\Controls\DataGridView\DataGridViewCellCollection.cs (2)
178
if (dataGridView is not null && dataGridView.Columns.
Count
> index)
290
if (dataGridView is not null && dataGridView.Columns.
Count
> index)
System\Windows\Forms\Controls\DataGridView\DataGridViewCellPaintingEventArgs.cs (3)
85
if (ColumnIndex < -1 || ColumnIndex >= _dataGridView.Columns.
Count
)
114
if (ColumnIndex < -1 || ColumnIndex >= _dataGridView.Columns.
Count
)
149
if (ColumnIndex < -1 || ColumnIndex >= _dataGridView.Columns.
Count
)
System\Windows\Forms\Controls\DataGridView\DataGridViewCheckBoxCell.cs (2)
832
ColumnIndex < DataGridView.Columns.
Count
&&
970
Debug.Assert((columnIndex >= 0) && (columnIndex < DataGridView.Columns.
Count
));
System\Windows\Forms\Controls\DataGridView\DataGridViewColumn.cs (1)
253
if (value >= DataGridView.Columns.
Count
)
System\Windows\Forms\Controls\DataGridView\DataGridViewColumnCollection.cs (6)
268
if (
Count
> 0)
282
for (int columnIndex = 0; columnIndex <
Count
; columnIndex++)
397
for (int i = 0; i <
Count
; i++)
505
_lastAccessedSortedIndex <
Count
);
1035
ArgumentOutOfRangeException.ThrowIfGreaterThanOrEqual(index,
Count
);
1059
Debug.Assert(index >= 0 && index <
Count
);
System\Windows\Forms\Controls\DataGridView\DataGridViewLinkCell.cs (1)
735
ColumnIndex < DataGridView.Columns.
Count
&&
System\Windows\Forms\Controls\DataGridView\DataGridViewRow.cs (5)
1073
int cellsCount = rowTemplate.Cells.
Count
;
1125
Debug.Assert(Cells.
Count
== dataGridView.Columns.
Count
);
1794
int cellCount = cells.
Count
;
1795
for (int columnIndex = 0; columnIndex < cells.
Count
; columnIndex++)
System\Windows\Forms\Controls\DataGridView\DataGridViewRow.DataGridViewRowAccessibleObject.cs (2)
181
for (int i = 0; i < _owningDataGridViewRow.Cells.
Count
; i++)
418
if (_owningDataGridViewRow.Cells.
Count
> 0)
System\Windows\Forms\Controls\DataGridView\DataGridViewRowCollection.cs (37)
194
if (DataGridView.Columns.
Count
== 0)
199
if (DataGridView.RowTemplate.Cells.
Count
> DataGridView.Columns.
Count
)
205
Debug.Assert(dataGridViewRow.Cells.
Count
== DataGridView.Columns.
Count
);
300
if (DataGridView.Columns.
Count
== 0)
328
if (DataGridView.Columns.
Count
== 0)
343
if (DataGridView.RowTemplate.Cells.
Count
> DataGridView.Columns.
Count
)
349
Debug.Assert(rowTemplate.Cells.
Count
== DataGridView.Columns.
Count
);
391
if (DataGridView.Columns.
Count
== 0)
396
if (dataGridViewRow.Cells.
Count
> DataGridView.Columns.
Count
)
416
Debug.Assert(dataGridViewRow.Cells.
Count
== DataGridView.Columns.
Count
);
736
if (DataGridView.Columns.
Count
== 0)
748
Debug.Assert(dataGridViewRow.Cells.
Count
== DataGridView.Columns.
Count
);
831
DataGridView.Columns.
Count
!= 0 &&
1412
if (DataGridView.Columns.
Count
== 0)
1417
if (DataGridView.RowTemplate.Cells.
Count
> DataGridView.Columns.
Count
)
1430
Debug.Assert(rowTemplate.Cells.
Count
== DataGridView.Columns.
Count
);
1474
if (DataGridView.Columns.
Count
== 0)
1479
if (dataGridViewRow.Cells.
Count
> DataGridView.Columns.
Count
)
1506
if (DataGridView.Columns.
Count
== 0)
1511
if (dataGridViewRow.Cells.
Count
> DataGridView.Columns.
Count
)
1518
Debug.Assert(dataGridViewRow.Cells.
Count
== DataGridView.Columns.
Count
);
1781
if (DataGridView.Columns.
Count
== 0)
1794
Debug.Assert(dataGridViewRow.Cells.
Count
== DataGridView.Columns.
Count
);
2401
int columnCount = DataGridView.Columns.
Count
;
System.Windows.Forms.Design (23)
System\Windows\Forms\Design\DataGridViewAddColumnDialog.cs (5)
86
bool forceColumnFrozen = _dataGridViewColumns.
Count
> _insertAtPosition && _dataGridViewColumns[_insertAtPosition].Frozen;
528
DataGridViewColumn[] cols = new DataGridViewColumn[_liveDataGridView.Columns.
Count
- _initialDataGridViewColumnsCount];
529
for (int i = _initialDataGridViewColumnsCount; i < _liveDataGridView.Columns.
Count
; i++)
534
for (int i = _initialDataGridViewColumnsCount; i < _liveDataGridView.Columns.
Count
;)
813
_initialDataGridViewColumnsCount = _liveDataGridView.Columns.
Count
;
System\Windows\Forms\Design\DataGridViewColumnCollectionDialog.cs (10)
198
DataGridViewColumn[] oldColumns = new DataGridViewColumn[_liveDataGridView.Columns.
Count
];
219
DataGridViewColumn[] newColumns = new DataGridViewColumn[_columnsPrivateCopy.
Count
];
220
bool[] userAddedColumnsInfo = new bool[_columnsPrivateCopy.
Count
];
221
string?[] compNames = new string?[_columnsPrivateCopy.
Count
];
222
for (int i = 0; i < _columnsPrivateCopy.
Count
; i++)
439
for (int i = 0; i < _columnsPrivateCopy.
Count
; i++)
877
for (int i = 0; i < _columnsPrivateCopy.
Count
; i++)
1110
_columnsNames.EnsureCapacity(_columnsPrivateCopy.
Count
);
1114
_userAddedColumns.EnsureCapacity(_liveDataGridView.Columns.
Count
);
1123
for (int i = 0; i < _liveDataGridView.Columns.
Count
; i++)
System\Windows\Forms\Design\DataGridViewDesigner.cs (8)
45
for (int i = 0; i < dataGridView.Columns.
Count
; i++)
52
for (int i = 0; i < dataGridView.Columns.
Count
; i++)
342
for (int i = 0; i < dataGridView.Columns.
Count
; i++)
404
for (int i = 0; i < dataGridView.Columns.
Count
; i++)
463
for (int i = 0; i < dataGridView.Columns.
Count
;)
584
DataGridViewColumn[] removeColumns = new DataGridViewColumn[dataGridView.Columns.
Count
];
586
for (int i = 0; i < dataGridView.Columns.
Count
; i++)
777
dialog.Start(Control.Columns.
Count
, persistChangesToDesigner: true);
System.Windows.Forms.Tests (13)
System\Windows\Forms\AccessibleObjects\DataGridViewAccessibleObjectTests.cs (4)
230
for (int j = 0; j < dataGridView.Rows[i].Cells.
Count
; j++)
1312
int columnCount = dataGridView.Columns.
Count
;
1343
int columnCount = dataGridView.Columns.
Count
;
1386
int columnCount = dataGridView.Columns.
Count
;
System\Windows\Forms\BaseCollectionTests.cs (2)
14
Assert.Throws<NullReferenceException>(() => collection.
Count
);
25
Assert.Equal(3, collection.
Count
);
System\Windows\Forms\DataGridViewSelectedCellCollectionTests.cs (1)
35
Assert.Equal(2, collection.
Count
);
System\Windows\Forms\DataGridViewSelectedColumnCollectionTests.cs (1)
39
Assert.Equal(2, collection.
Count
);
System\Windows\Forms\DataGridViewSelectedRowCollectionTests.cs (1)
34
Assert.Equal(2, collection.
Count
);
System\Windows\Forms\DataGridViewTests.cs (4)
2811
Assert.Equal(2, control.Columns.
Count
);
2852
Assert.Equal(2, control.Columns.
Count
);
2858
Assert.Equal(2, control.Columns.
Count
);
2866
Assert.Equal(2, control.Columns.
Count
);