Ejemplo n.º 1
0
        //  finds the first name and last name of all students with age between 18 and 24.
        public static string[] AgeRange(Student[] students)
        {
            string[] result = students
                .Where(student => student.Years >= 18 && student.Years <= 24)
                .Select(student => String.Format("{0}\t{1}", student.FirstName, student.LastName))
                .ToArray();

            return result;
        }
Ejemplo n.º 2
0
        // from students[] finds all students whose first name is before its last name alphabetically.
        public static Student[] FirstBeforeLastName(Student[] students)
        {
            Student[] returnStudents = students.Where(s => s.FirstName.CompareTo(s.LastName) < 0).ToArray();

            return returnStudents;
        }