Geni Lou

Geni Lou

  • NA
  • 101
  • 24.2k

Converting List

Mar 27 2021 3:46 PM
is this the best way to convert a repository to model?
  1. public static List<ProductRepository> ToRepositories(this List<ProductModel> model){  
  2. var repo = new List<ProductRepository>();  
  3. foreach (var m in model){  
  4. repo.Add(m.ToRepository());  
  5. }  
  6. return repo;  
  7. }  

Answers (3)