posible solucion al caso de que nos devuelva un null
public Book? lowerPageNumberBook(IEnumerable<Book> books){
return books.Where(b=>b.PageCount>0).FirstOrDefault() is null? new Book(): books.Where(b=>b.PageCount>0).MinBy(b=>b.PageCount);
}
public Book? recentPublishDateBook(IEnumerable<Book> books){
return books.MaxBy(b=>b.PublishedDate) is null? new Book(): books.MaxBy(b=>b.PublishedDate);
}
Want to see more contributions, questions and answers from the community?