I have a list of class Item:
public class Item
{
public int Id { get; set; }
public string Name { get; set; }
public int ItemSize { get; set; }
public int? ContainerId { get; set; }
}
and also a class Container
public class Container
{
public int Id { get; set; }
public int ContainerSize { get; set; }
}
A container have a Max Value for the property Size. I need to assign each object of List to a container, taking care about these rules:
Object of List Item which share the same name MUST be placed on the same Container. Of course it is impossible to have a number of Item with the same Name with TotalSize > Max Container Size.
I have to create the less possibile number of Containers
Any advice is greatly appreciated.