Let's say I have the following methods in my code:
public bool RemoveItem(Item item)
{
}
public bool RemoveItems(List<Item> items)
{
}
public bool AddItem(Item item)
{
}
public bool AddItems(List<Item> items)
{
}
Is there a way to prevent using multiple methods for each operation? I have many such methods. I want to somehow combine each pair of methods into one. Is there a good way to do this?
I can create a single-element list and only support methods that take the list as a parameter, but it seems ugly to me.
How do other people do it?
source
share