public int CompareTo(object obj) { Call anotherCall = obj as Call; if (anotherCall == null) { throw new InvalidOperationException($"{nameof(anotherCall)} must not be null"); } if (CallTime.Count == 0 || anotherCall?.CallTime.Count == 0) { throw new InvalidOperationException($"{nameof(CallTime)} must not be empty"); } return(CallTime.Last().Time.CompareTo(anotherCall.CallTime.Last().Time)); }
public Call(Contact contact, string number, DateTime time, bool isIncoming) { this.contact = contact; CallTime.Add(new CallTime(number, time)); IsIncoming = isIncoming; }