using System; using System.Collections.Generic; using System.Linq; public class EmployeeDto { public int Id { get; set; } public string Name { get; set; } } public class EmployeeEntity { public int Id { get; set; } public string FullName { get; set; } } class Program { static void Main(string[] args) { List o = new List(); o.Add(new EmployeeDto { Id = 1, Name = "Bob" }); o.Add(null); o.Add(new EmployeeDto { Id = 2, Name = "Foo" }); o.Add(null); o.Add(null); var employeeEntityList = MapList1(o); var employeeEntityList2 = MapList2(o); PrintEmployee(employeeEntityList); Console.WriteLine("--"); PrintEmployee(employeeEntityList2); Console.ReadKey(); } private static void PrintEmployee(IEnumerable employeeEntityList) { foreach (var item in employeeEntityList) { Console.WriteLine(item.FullName); } } private static IEnumerable MapList1(List o) { return from i in o.OfType() select new EmployeeEntity { Id = i.Id, FullName = i.Name }; } private static IEnumerable MapList2(List o) { return from si in o let i = si as EmployeeDto where i != null select new EmployeeEntity { Id = i.Id, FullName = i.Name }; } }