I am trying to write a basic abstract class where any class that extends it will have a List
of some type.
The context is I call a web service, and I receive "pages" of orders, and each order has "pages" of order lines, etc.
abstract class Pagination
{
public int _offset { get; set; }
public int _total { get; set; }
public string previous { get; set; }
public string next { get; set; }
// Can I add something here that represents a list of items
// that is overridden in child classes somehow?
// public abstract List<Something?> items { get; set; }
// The purpose is for this generic "getItemCount" function or something similar
/*
public int getItemCount()
{
return items != null ? items.Count() : 0;
}
*/
}
class OrderHeader : Pagination
{
public int orderId { get; set; }
public List<OrderLine> items { get; set; }
}
class OrderLine : Pagination
{
public string sku { get; set; }
public int qty { get; set; }
public List<OrderLineDetails> items { get; set; }
}
class OrderLineDetails
{
public string serialNum { get; set; }
}