Suppose I have an object model somewhat like this:
public class MyModel
{
public List<long> TotalItems { get; set; }
public List<long> ItemsApples { get; set; }
public List<long> ItemsOranges { get; set; }
public List<long> ItemsPeaches { get; set; }
public void CombineItems()
{
}
}
Now in reality, there are about 14 lists of longs in the model. What the best way to combine these lists so that TotalItems is the list of all other lists combined.
Thanks for your suggestions.
Create a new
List<long>, then callAddRange()to add each of your existing lists to it.