static void Main(string[] args) { //5,6,7,8,9 VectorList<User> Users = new VectorList<User>(5); Users.elements[0] = new User { Id = 1, Name = "John", Phone = "1234567", Age = 20 }; Users.elements[1] = new User { Id = 2, Name = "Jane", Phone = "4365745674", Age = 40 }; Users.elements[2] = new User { Id = 3, Name = "Max", Phone = "34563546", Age = 60 }; Users.elements[3] = new User { Id = 4, Name = "Eva", Phone = "96798", Age = 80 }; Users.elements[4] = new User { Id = 5, Name = "Mickel", Phone = "3245", Age = 100 }; var temp = Users.Select(x=>x.Age>30 && x.Age<100).Select(x=> { string newname = x.Name = " " + x.Age; return new { Name = newname, Age = x.Age }; }).Select(x => x.Name); double maxage = Users.max(x => x.Age) }
static void Main(string[] args) { VectorList <User> Users = new VectorList <User>(5); Users[0] = new User { Id = 1, Name = "John", Phone = "1234567", Age = 20 }; Users[1] = new User { Id = 2, Name = "Jane", Phone = "4365745674", Age = 40 }; Users[2] = new User { Id = 3, Name = "Max", Phone = "34563546", Age = 60 }; Users[3] = new User { Id = 4, Name = "Eva", Phone = "96798", Age = 80 }; Users[4] = new User { Id = 5, Name = "Mickel", Phone = "3245", Age = 100 }; var tu1 = Users.Select(x => new { User = x.Name, Phone = long.Parse(x.Phone) }); var olds = Users.Where(x => x.Age > 40).Where(x => x.Age < 80).Select(x => new { User = x.Name, Phone = long.Parse(x.Phone) }); }