There's probably a very simple reason for this, but when hydrating an object I'm keep getting a "value cannot be null" exception:
public class MyObject
{
public MyObject() {
}
public virtual IList<MemberObject> MemberObjects { get; protected set; }
[JsonProperty] public virtual SubObject LastMemberObject {
get { return MemberObjects.OrderByDescending(x => x.CreatedOn).FirstOrDefault() ?? null; }
}
}
When hydrating the object, if the MemberObjects is null, LastMemberObject throws a cannot be null exception. What's the deal?