First of all, it was difficult to find a proper title for my question... sorry in advance for this.
I am facing an issue with C# .NET. I'll try to simplify it with a temporary example.
I have three classes:
book movie_dvd game_dvd
each of them have the same base properties such: id and name. We can however suppose they have other different properties and different methods to be the same class. They can of course be children of a parent class to make it better.
Then I create List of each of these classes to define my collection of books, movies and games. Their id property is of course matched with the key of the List, and as I insert each item in the List I give them an appropriate name (their title).
I have a main winForm with 3 buttons: “Show Books Collection”, “Show Movies Collection” and “Show Games Collection”. The user can click one of them, and then another window appear and show the passed collection inside a ListBox (or whatever).
Now here's my problem.
Right now I'm creating three separate (but almost identical) WinForms to display the content of each collection (books, movies, games), which I think is greatly overdoing things. What I would really like to do is create a single window to display the content of any of these collections. The problem is that if I pass a book object/class inside the parameters of the new winForm, on the other side it expects to be a book object.
How can I use a single Winform to display the title of each of these differnt objects without duplicating the WinForm code over and over?