I'm using a MVC/MCP pattern for my C# (WinForms) application.
In the business logic I have derived classes like
abstract public class Item
{
abstract double CalculatePrice();
...
}
public class Nail : Item
{
...
}
public class Car : Item
{
...
}
For the business logic the derived type of an item doesn't matter. I always can call methods like CalculatePrice() no matter what type the item really is.
But How do I handle such items at the UI (WinForms) when presenting these items to the user? (and of course a Car is presented differently than a Nail)
- I do not want to have a big switch statement in the UI / controller to handle all types of items.
I do not want to implement a
abstract double ShowMeAtUI()
method in the item class, because this is business logic and it should not care about UI stuff.
So what is the cleanest preferred way to design this.
Thanks in advance!!