dotnet / dotnet/winforms

Enumerators of DataGridView.Rows and DataGridView.Columns return object, not DataGridViewRow and DataGridViewColumn

Open
#9,655 2 comments 0 reactions 0 assignees View on GitHub
api-suggestion area-controls-DataGridView tenet-performance
Dominant language
C#
Stars
4.9k
Forks
1.1k
Avg merge
20h 23m
Merged PRs (30d)
103

Description

### .NET version

7

### Did it work in .NET Framework?

No

### Did it work in any of the earlier releases of .NET Core or .NET 5+?

No

### Issue description

Indexers of DataGridView.Rows and DataGridView.Columns return DataGridViewRow and DataGridViewColumn. But enumerators - return object. Can it be something other than DataGridViewRow and DataGridViewColumn? Unconvinient. If I use foreach cycle, I have to make cast.

### Steps to reproduce

Write it in VS:

```
foreach (var Variable in DataGridView.Rows)
{
// The type of Variable is object
}
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.