示例#1
0
        override public string ToString()
        {
            string output = "";

            if (entrees.Count > 0)
            {
                entrees.Sort((x, y) => y.Date.CompareTo(x.Date));
                DiaryEntree lastEntree = entrees.Last();
                foreach (DiaryEntree entree in entrees)
                {
                    output += entree.Title + " (Watched: " + entree.Date.ToShortDateString() + ")";
                    if (entree != lastEntree)
                    {
                        output += "\n";
                    }
                }
            }
            return(output);
        }
示例#2
0
        public string RecentEntreesToString()
        {
            string output = "";

            if (entrees.Count > 0)
            {
                entrees.Sort((x, y) => y.Date.CompareTo(x.Date));
                List <DiaryEntree> recentEntrees = entrees.GetRange(0, Math.Min(RecentEntreesCount, entrees.Count));
                DiaryEntree        lastEntree    = recentEntrees.Last();
                foreach (DiaryEntree entree in recentEntrees)
                {
                    output += entree.Title + " (Watched: " + entree.Date.ToShortDateString() + ")";
                    if (entree != lastEntree)
                    {
                        output += ", ";
                    }
                }
            }
            return(output);
        }