Is it against best practices to create a class that serves the purpose of combining data from two other existing classes in order to create a DataGridView with only the elements I want from each of said classes? For example:
Class 1
int classOneId (Primary Key)
string classOneName
Class 2
int classOneId
string classTwoResult
datetime classTwoDate
I want to populate a DataGridView with elements from both of these classes, so could I create a third class:
Class 3
int classOneName
string classTwoResult
datetime classTwoDate
An object of this class would then be made by an SQL statement that joined the two previous classes by the classOneId. Then I could create a list of Class 3 objects to populate the DataGridView. Is this acceptable to do?
Aucun commentaire:
Enregistrer un commentaire