Tuesday 25 October 2016

add range in List C#

public List<EmpDto> GetEmps()
        {
            var empDtoList = new List<EmpDtoList>();
            using (_dbContextScopeFactory.Create(connectionString))
            {
                var empEntity = _empRepository.GetAll();
                empDtoList .AddRange(empEntity .Select(x => new EmpDto
                {
                    Id = x.Id,
                    Name = x.Name,
                    Description = x.Description,
                  
                }));
            }
            return empDtoList ;
        }

No comments:

Post a Comment