using System; using System.Collections.Generic; using System.Text; namespace Blog3000.Shared { public static class RevisionExtensions { public static Revision Latest(this List revs) { if (revs != null && revs.Count > 0) { var r = new List(revs); r.Sort((a, b) => DateTime.Compare(a?.ChangedAt ?? DateTime.MinValue, b?.ChangedAt ?? DateTime.MinValue)); return r[r.Count - 1]; } return null; } } }