Вопрос

I would like to know the difference between DataView and DataRowView. I looked up on MSDN and it says the DataRowView is just a customized representation of DataView.

But can you also cast a DataView to DataRowView? Please explain

Many thanks

Это было полезно?

Решение 2

A DataRowView is a DataRow from a DataView.

Другие советы

A DataView is a subset of a DataTable, or a special "View" of it.

Represents a databindable, customized view of a DataTable for sorting, filtering, searching, editing, and navigation. The DataView does not store data, but instead represents a connected view of its corresponding DataTable. Changes to the DataView’s data will affect the DataTable. Changes to the DataTable’s data will affect all DataViews associated with it.

A DataRowView is a row in the DataView, so it's a special "View" of a DataRow.

Represents a customized view of a DataRow.

The two are not the same thing.

The DataRowView object does have a Row property, which points it to the DataRow it represents. Likewise, the DataView object has a Table property, which points it to the DataTable it represents.

MSDN says that a DataRowView is:

Represents a customized view of a DataRow.

So it is not referring to the DataView.

However the DataRowView is just a class used to represent a DataRow in the sort order applied to the DataView. In fact you could find between its properties the reference back to the DataRow

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top