Is there a shorter, better and optimised way to fill this list from SQL database
Is there a shorter, better and optimised way to fill this list from SQL database I got this code and it works without problems. But i sense there is much better way to do this. namespace Repositories { public class AuthorRepository : IAuthorRepository { public List<Author> GetAllFromRepo() { using (AppContext myDB = new AppContext()) { List<Author> authorsFromRepo = new List<Author>(); foreach (var item in myDB.Authors) { authorsFromRepo.Add(new Author() { Books = new List<Book>(), ID = item.ID, FirstName = item.FirstName, LastName = item.LastName }); } return authorsFromRepo.ToList(); } ...