/// <summary> /// Creates a new instance of <see cref="TieredList{T}"/> that /// is populated with items copied from the specified collection. /// </summary> /// <param name="owner"> /// The tiered list item that owns this list as its children. /// </param> /// <param name="collection"> /// The collection whose items are copied to the new list. /// </param> public TieredList(ITieredListItem <T> owner, IEnumerable <ITieredListItem <T> > collection) { if (collection != null) { foreach (var item in collection) { item.Parent = owner; } } Owner = owner; ListItems = new List <ITieredListItem <T> >(collection); }
/// <summary> /// Creates a new instance of <see cref="TieredList{T}"/> that /// is empty but has an initial capacity of the amount specified. /// </summary> /// <param name="owner"> /// The tiered list item that owns this list as its children. /// </param> /// <param name="capacity"> /// The initial capacity of the new list. /// </param> public TieredList(ITieredListItem <T> owner, int capacity) { Owner = owner; ListItems = new List <ITieredListItem <T> >(capacity); }
/// <summary> /// Creates a new instance of <see cref="TieredList{T}"/>. /// </summary> /// <param name="owner"> /// The tiered list item that owns this list as its children. /// </param> public TieredList(ITieredListItem <T> owner) { Owner = owner; ListItems = new List <ITieredListItem <T> >(); }