I have two lists of the same type and I want to be able view a list of both lists:    public List<Page> HeaderPages;    public List<Page> SurveyPages;    public IReadOnlyList<Page> AllPages     {         get         {            List<Page> allPages = new List<Page>();            allPages.AddRange(this.HeaderPages);            allPages.AddRange(this.SurveyPages);            return allPages;        }     }I think it is very inefficient to keep creating a new list object each time I want to get AllPages, so I thought I could store a private allPages list.  But then I thought if I am in the class, I would have to remember to use the public AllPages rather than the private allPages - which may not be up-to-date.Any elegant solutions?
Inefficient code inside of getter?
c#;properties
If you have control over the design of the Page class, I would add a bool IsHeader property to it and keep one public list of all Page objects and add every Page object to that list. Instead of keeping several other lists that sort your Page objects, you can then perform searches on that master list instead for Page objects with certain properties, preferably with LINQ statements.