using System.Reflection.PortableExecutable; namespace ComiServ.Models { public class Truncated { public int Max { get; } public int Count { get; } public bool Complete { get; } public List Items { get; } public Truncated(int max, IEnumerable items) { if (max <= 0) { throw new ArgumentOutOfRangeException(nameof(max), max, "must be greater than 0"); } Max = max; Items = items.Take(max+1).ToList(); if (Items.Count <= max) { Complete = true; if (Items.Count > 0) Items.RemoveAt(max); } else { Complete = false; } Count = Items.Count; } } }