1 00:00:00,420 --> 00:00:01,330 ‫Welcome back. 2 00:00:01,350 --> 00:00:08,760 ‫Now you know how to reverse, how to sort order and those kind of things of your arrays and lists and. 3 00:00:08,760 --> 00:00:10,200 ‫Well, I enumerable. 4 00:00:10,290 --> 00:00:13,210 ‫But what we're going to do now is something pretty cool. 5 00:00:13,230 --> 00:00:18,240 ‫We are going to combine to lists and put them into a new list. 6 00:00:18,240 --> 00:00:23,670 ‫So it's very similar to combining two tables, but we're doing something with link. 7 00:00:23,670 --> 00:00:26,760 ‫So let's create a new method here. 8 00:00:27,090 --> 00:00:34,650 ‫Let's call it student and university name collection. 9 00:00:34,650 --> 00:00:39,900 ‫So we're going to create a new collection which will not contain the students in a way that we have 10 00:00:39,900 --> 00:00:40,410 ‫them here. 11 00:00:40,410 --> 00:00:49,320 ‫So ID name gender, age and university ID, but more like I want to know the student and the university. 12 00:00:49,470 --> 00:00:51,930 ‫So the student name and the university name. 13 00:00:51,930 --> 00:00:55,050 ‫So I want to know which student name is at which university. 14 00:00:55,050 --> 00:00:56,760 ‫So let's go ahead and build that. 15 00:00:56,970 --> 00:01:06,840 ‫And we create a new collection so far, new collection which will take student in students. 16 00:01:06,840 --> 00:01:08,910 ‫So another for each loop. 17 00:01:08,970 --> 00:01:11,850 ‫And it's going to join university 18 00:01:13,410 --> 00:01:31,230 ‫university and Univer cities on our student thought university ID equals university. 19 00:01:33,950 --> 00:01:39,950 ‫Thought I'd and we're going to order them by their name. 20 00:01:39,950 --> 00:01:40,220 ‫So. 21 00:01:40,220 --> 00:01:42,230 ‫Student Dot name. 22 00:01:43,280 --> 00:01:49,340 ‫And now what I want to do is I want to select them and create a new list out of it. 23 00:01:49,340 --> 00:02:00,530 ‫So new student name is equal to student dot name and university 24 00:02:02,720 --> 00:02:12,650 ‫name is equal to university dot and here universal city dot name. 25 00:02:13,340 --> 00:02:19,910 ‫So we fetch all students and the university ordered them by their name and put their names in a new 26 00:02:19,910 --> 00:02:23,270 ‫object together with the names of their university. 27 00:02:23,270 --> 00:02:28,370 ‫So that's pretty much what we do with this line of code here and now. 28 00:02:28,370 --> 00:02:34,520 ‫What we can do, we can write that on to the console so we can just going to say something like new 29 00:02:34,550 --> 00:02:36,170 ‫collections. 30 00:02:39,030 --> 00:02:50,030 ‫Or actually it's a singular new collection and this will be for each and var in call calls standing 31 00:02:50,040 --> 00:02:53,130 ‫for collections in new collection. 32 00:02:53,130 --> 00:02:55,800 ‫So we're going to go through every single collection. 33 00:02:56,310 --> 00:03:09,780 ‫And what I want to print out now is CW Student Zero from University one 34 00:03:12,780 --> 00:03:21,270 ‫And now we need to call that student name and call that university name. 35 00:03:21,900 --> 00:03:27,120 ‫So we cut them off and now let's just print it out. 36 00:03:27,120 --> 00:03:27,660 ‫So see. 37 00:03:27,660 --> 00:03:35,700 ‫W So we're going to say student at the position zero, which means, well, we just want to have the 38 00:03:35,700 --> 00:03:47,940 ‫student name here from university which will be one, and the student name is called Dot Student Name 39 00:03:48,840 --> 00:03:53,160 ‫and the university name is called our university name. 40 00:03:54,000 --> 00:03:56,130 ‫So this pretty much does it. 41 00:03:56,880 --> 00:04:03,210 ‫It gives me that one collection aspect of my new collections, and it's going to give me or print that 42 00:04:03,210 --> 00:04:03,450 ‫out. 43 00:04:03,450 --> 00:04:07,200 ‫So it's going to print out the first student and the second student and so forth. 44 00:04:07,200 --> 00:04:11,190 ‫So all the students and their universities. 45 00:04:11,370 --> 00:04:18,060 ‫So let's call that method here at the top before doing this ordering thing. 46 00:04:18,060 --> 00:04:22,380 ‫So let me uncomment that. 47 00:04:22,410 --> 00:04:27,900 ‫Now, let's go ahead and call this method student and university name collection. 48 00:04:28,260 --> 00:04:29,550 ‫Now let's run it. 49 00:04:32,350 --> 00:04:40,150 ‫And we are so new collection student Carla from University, Yale student Frank from University, Beijing 50 00:04:40,270 --> 00:04:41,620 ‫and so forth. 51 00:04:41,620 --> 00:04:50,410 ‫So you see all of those guys and ladies and all of their universities and they're ordered by their name. 52 00:04:50,980 --> 00:04:51,350 ‫So. 53 00:04:51,370 --> 00:04:53,080 ‫C c f. 54 00:04:53,080 --> 00:04:54,490 ‫J l t. 55 00:04:55,750 --> 00:04:56,320 ‫All right. 56 00:04:56,320 --> 00:05:01,540 ‫So now you see how you can create new collections based on collections that you had already. 57 00:05:01,840 --> 00:05:08,470 ‫So what we simply do here is we loop through all students and we join that with a university. 58 00:05:08,470 --> 00:05:12,640 ‫So it's pretty much the same thing that we've done here with all students from that uni. 59 00:05:13,030 --> 00:05:16,870 ‫Then we order them by name and then we select. 60 00:05:16,870 --> 00:05:23,860 ‫And now instead of selecting the student, we select a completely new collection. 61 00:05:23,890 --> 00:05:27,760 ‫We just say, okay, I want that to happen for every single student. 62 00:05:27,760 --> 00:05:33,010 ‫So I want this combination of student name and university name for every single student. 63 00:05:33,010 --> 00:05:37,240 ‫And now we have this new collection, which is pretty much a list. 64 00:05:37,630 --> 00:05:45,310 ‫So it's a new enumerable and you list of students which contains now all of our students with the university 65 00:05:45,310 --> 00:05:45,790 ‫name. 66 00:05:45,790 --> 00:05:48,130 ‫So it doesn't have any additional information. 67 00:05:48,150 --> 00:05:50,800 ‫It only has the student name and the university name. 68 00:05:50,800 --> 00:05:55,300 ‫It doesn't know about the ID, doesn't know about all those kind of things, and only knows those two 69 00:05:55,300 --> 00:06:01,180 ‫things, which is name and university name where student name and university name and well, we use 70 00:06:01,180 --> 00:06:09,220 ‫that to print it out here so we could store that in a different table if we would use as SQL here, 71 00:06:09,220 --> 00:06:11,800 ‫and we will do so later on. 72 00:06:12,040 --> 00:06:16,060 ‫But that's something that we first of all needed to check out. 73 00:06:16,060 --> 00:06:22,820 ‫So we first needed to understand what's going on with Lync and what it can do even without using SQL. 74 00:06:22,840 --> 00:06:24,760 ‫And you already see the advantage. 75 00:06:24,760 --> 00:06:28,930 ‫You can use that with collections of different types in C-sharp. 76 00:06:28,930 --> 00:06:32,260 ‫You can use that with XML and you can use it with SQL. 77 00:06:32,260 --> 00:06:39,790 ‫So you're not limited to one data source, which is pretty awesome because in the past you had to create 78 00:06:39,790 --> 00:06:44,620 ‫all of those different adapters which did all the job. 79 00:06:45,670 --> 00:06:47,200 ‫So that's it for this video. 80 00:06:47,200 --> 00:06:50,620 ‫In the next video we're going to do some more sick link stuff. 81 00:06:50,620 --> 00:06:51,670 ‫So see you there.