Beispiel #1
0
        public void Get()
        {
            var result = students.Select(s =>
            {
                // var g = new Graduate();
                // var g = new Graduate(s.Id, s.FirstName + " " + s.LastName);
                var g = new Graduate {
                    Id = s.Id, Name = s.FirstName + " " + s.LastName
                };

                g.Id   = s.Id;
                g.Name = s.FirstName + " " + s.LastName;

                return(g);
            });

            var result2 = students.Select(student => new Graduate
            {
                Id   = student.Id,
                Name = student.FirstName + " " + student.LastName
            });

            var result3 = students.Select(student => new
            {
                Id   = student.Id,
                Desc = student.Name + ":" + student.Age
            });
        }
Beispiel #2
0
        public void Get()
        {
            var result = students.Select(s =>
            {
                // var g = new Graduate();
                // var g = new Graduate(s.Id, s.FirstName + " " + s.LastName);
                var g = new Graduate { Id = s.Id, Name = s.FirstName + " " + s.LastName };

                g.Id = s.Id;
                g.Name = s.FirstName + " " + s.LastName;

                return g;
            });

            var result2 = students.Select(student => new Graduate
                {
                    Id = student.Id,
                    Name = student.FirstName + " " + student.LastName
                });

            var result3 = students.Select(student => new
            {
                Id = student.Id,
                Desc = student.Name + ":" + student.Age
            });
        }
Beispiel #3
0
        public IList <Graduate> GetGraduates3()
        {
            IList <Graduate> result =
                Enumerable.ToList <Graduate>(
                    Enumerable.Select <Student, Graduate>(
                        Enumerable.Where <Student>(students,
                                                   delegate(Student s)
            {
                return(s.AvgScore > 60);
            }),
                        delegate(Student s)
            {
                Graduate s1 = new Graduate();
                s1.Name     = s.FirstName + " " + s.LastName;

                return(s1);
            }
                        )
                    );

            return(result);
        }
Beispiel #4
0
        public IList<Graduate> GetGraduates3()
        {
            IList<Graduate> result =
                Enumerable.ToList<Graduate>(
                    Enumerable.Select<Student, Graduate>(
                        Enumerable.Where<Student>(students,
                            delegate(Student s)
                            {
                                return s.AvgScore > 60;
                            }),
                                delegate(Student s)
                                {
                                    Graduate s1 = new Graduate();
                                    s1.Name = s.FirstName + " " + s.LastName;

                                    return s1;
                                }
                            )
                        );

            return result;
        }