public static StudentIndexableCollection CreateMockStudents(int count, int startRange, int endRange)
        {
            var students = new StudentIndexableCollection();

            for (int i = 0; i < count; i++)
            {
                var student = Student.CreateRandomStudent(startRange, endRange);
                student.Id = i;
                students.Add(student);
            }
            return(students);
        }
        public void JoinTest()
        {
            int setASize = 10;
            int setBSize = SampleSize;

            int nameCount = Convert.ToInt32(Math.Max(setASize, (double)setBSize) * 0.02);

            if (nameCount == 0)
            {
                nameCount = 1;
            }

            var studentsA = StudentIndexableCollection.CreateMockStudents(setASize, 0, nameCount);
            var studentsB = StudentIndexableCollection.CreateMockStudents(setBSize, 0, nameCount);

            var arrayStudentsA = new Student[studentsA.Count];
            var arrayStudentsB = new Student[studentsB.Count];

            studentsA.CopyTo(arrayStudentsA, 0);
            studentsB.CopyTo(arrayStudentsB, 0);

            Thread.Sleep(0);
            using (new OperationTimer("Indexed")) {
                //var q = from s1 in studentsA
                //        join s2 in studentsB on s1.FirstName equals s2.FirstName
                //        select new { s1.FirstName, s2.LastName };
                var q = studentsA.Join(studentsB,
                                       s1 => s1.FirstName, s2 => s2.FirstName,
                                       (s1, s2) => new { s1.FirstName, s2.LastName });

                Console.WriteLine("Indexed sequece joined results count: " + q.Count());
            }

            Thread.Sleep(0);
            using (new OperationTimer("Non Indexed")) {
                //var q = from s1 in arrayStudentsA
                //        join s2 in arrayStudentsB on s1.FirstName equals s2.FirstName
                //        select new {s1.FirstName, s2.LastName};
                var q = arrayStudentsA.Join(arrayStudentsB,
                                            s1 => s1.FirstName, s2 => s2.FirstName,
                                            (s1, s2) => new { s1.FirstName, s2.LastName });

                Console.WriteLine("Nonindexed sequece joined results count: " + q.Count());
            }

            Thread.Sleep(0);
            using (new OperationTimer("Indexed")) {
                //var q = from s1 in studentsA
                //        join s2 in studentsB on s1.FirstName equals s2.FirstName
                //        select new { s1.FirstName, s2.LastName };
                var q = studentsA.Join(studentsB,
                                       s1 => s1.FirstName, s2 => s2.FirstName,
                                       (s1, s2) => new { s1.FirstName, s2.LastName });

                Console.WriteLine("Indexed sequece joined results count: " + q.Count());
            }

            Thread.Sleep(0);
            using (new OperationTimer("Non Indexed")) {
                //var q = from s1 in arrayStudentsA
                //        join s2 in arrayStudentsB on s1.FirstName equals s2.FirstName
                //        select new {s1.FirstName, s2.LastName};
                var q = arrayStudentsA.Join(arrayStudentsB,
                                            s1 => s1.FirstName, s2 => s2.FirstName,
                                            (s1, s2) => new { s1.FirstName, s2.LastName });

                Console.WriteLine("Nonindexed sequece joined results count: " + q.Count());
            }
        }