Generic and Non-Generic Collections in C# | Ahmad Mohey | Skillshare

Generic and Non-Generic Collections in C#

Ahmad Mohey, Software Developer & Instructor

Play Speed
  • 0.5x
  • 1x (Normal)
  • 1.25x
  • 1.5x
  • 2x
30 Lessons (3h 43m)
    • 1. Introduction to the chapter

      1:00
    • 2. Introduction to Collections

      3:12
    • 3. ArrayList

      20:54
    • 4. Hashtable

      11:18
    • 5. SortedList

      11:07
    • 6. Stacks

      4:20
    • 7. Queues

      3:02
    • 8. BitArray

      9:21
    • 9. List of Animals and Trainers Exercise

      12:50
    • 10. Lists

      11:20
    • 11. Dictionary

      15:31
    • 12. Generic SortedList

      12:54
    • 13. Generic SortedDictionary

      7:02
    • 14. Generic Stack

      3:44
    • 15. Generic Queue

      4:41
    • 16. KeyValuePair

      7:57
    • 17. NameValueCollection

      6:05
    • 18. List of Animals Exercise

      6:15
    • 19. Generic Classes

      9:31
    • 20. Generic Exercise Part 1

      10:26
    • 21. Generic Exercise Part 2

      6:09
    • 22. Tuples

      6:05
    • 23. Nested Tuples

      4:31
    • 24. Tuples With Methods

      5:14
    • 25. Tuples Exercise

      8:03
    • 26. Value Tuples

      5:57
    • 27. Nested Value Tuples

      2:52
    • 28. Value Tuples Exercise

      4:19
    • 29. Value Tuples with Methods

      5:21
    • 30. Summary

      1:56

About This Class

Hello and welcome to Generic and Non-Generic Collections in C# Class, In this class we are going to explore and work with the two types of collections available in C#: non-generic collections and generic collections. 

we are going to learn everything about collections such as 

  • Difference between a generic collection and a non-generic collection.

  • Learn how to work with Arraylists
  • SortedLists

  • Understand and work with Stacks and Queues

  • Work with Hashtables

  • Get to work with generic Lists and Dictionaries

  • KeyValuePairs

  • Tuples and Value Tuples
  • Create generic classes

So get ready to learn all about collections (generic and non-generic).

Transcripts

1. Introduction to the chapter: Hello and welcome to the advance. Its seashore. Part two chapter in this chapter will be discussing dinner collections and the Nun Genetic Collection. We will see the ray list and we will see that you're very good replacement. A normal raise was three easy messages and function that will be using to do various tasks only race. We'll see these tax and the cuse and will explain the concepts off each of this. Their knowledge is we'll see. Generic list. How can we can read a generic plays that have when we add high teams and remove items? Toe this dinner last and we will seize the dictionary. We will also be creating custom generic blesses, and we'll be also talking about kibbles the older tables in seizure. And then you were jewels that was introduced in C sharp seven. It's gonna be a long chapter, so get yourself ready and start chapter. Do you 2. Introduction to Collections: In this lecture, we will be discussing some senior. It is collections. Collections actually, is a group of related objects. Placed together. We have seen forms off the collection for with the rays, the rays actually in the form of a collection where some elements are grouped together inside of on a rate. But in this video we will be discussing more both collections other than a race. So collections actually provides a more flexible way to work with the group objects as we will see so sick of it as an array with some superpowers. There's two types of collections inside of C show is your memory saying the luncheonette. Let's take the plunge in characters, each element inside off the engine. Eric collection can be represented with a value for different times, so I can have an end string or even a class at a time for class with an enumeration inside one collection in the nine generic collections, evidence can be added or removed, a trend time while the program's running, which is very powerful, the size is not fix it, so I can increase or shrink the size of the collection. Anything that might work very easily as you'll see old and underwrite collections are placed inside this name space system of collections. It's very easy droid, the code off the imaginary collection that just e class that we will be creating an instance off it and start using the message of this class. Now let's go ahead and take a look at this. You know, you know, like actually Elevens you to define a glass with a message with busy time as a prisoner, so we can, said the message to be an end to a string. There. I'm sending the type of the printer. It's very powerful. You start using generic collections if you have only when data time inside of your collection. It's unlike the Nun generic collection, which takes different. It didn't type elements. It enforces something cold time safety type. Safety means that no other data can be added to it. If I define this collection to be an M, then the compiler will check if I must assign it and do not. If I try to assign a string, it would give me an error. If I tried to assign any data type, it will give me an error this is what means by type safety. It's inside of this name. Space system collections. Generally, it's a little bit harder to write the code with the generics because it's more abstract, more generic federal scene of it. It's not that hard, but it's a little bit harder than the non generic collections. So this is a very brief introduction about the engine Eric engineer collections. In the next lectures, we will be taking them 1.1 to you. 3. ArrayList: in this picture we will be creating our first collection, which is on generic religious ruins, actually is an alternative to a race with some enhancements features that make life easier when using a race. Everyone's stories, elements of any decide even inside one rain. It can contain multiple data types of king canteen and string, a date tart or even a custom class that we've created. The realist resize is automatically as you're adding or removing elements was over to you. Doing any singing elements can be no or duplicated insulin ray lists. Let's go ahead and see How can we do this incision? To start using the collection of Ray list, we need to add the name space. That's realist inside, which is the system, not collections in here. Or you can go ahead and use the full name, which is the system collections, not ray list. But this time I told you something. You I can go ahead and type this a ready list. This is the name of the class that they will be using. As you can see, it's giving me an air because I did not include the name space. It's inside. We homer over the name here, There. Is this my green here with lamb, I can go ahead on business. I couldn't plus the beside the lamp. Actually, let's go ahead. And this actually gives me a solution that the until the sense of visual studio is telling me that this is a possible solutions for this error. Actually, the 1st 1 is the one I want, which is having the name space. It's telling me that I will be having the system collections up here, So take a look at here. When I press this, it's added an article. Now we can go ahead and create much worse array. Of course. Ready? You can go ahead and name it whatever you want. No incubated moisture. It's a rate. Let's go ahead and try to have items a savory so I only create. We'll use the ray instance and they will be using the mess up. That's an object with the end it have through the end. This is very important. Ever begin to the end of the array list, so go ahead and have the first item goal it first, then my adding another one second and again they'll be adding another one. Actually, I will be having a injury. I relapsed. Is he accepted it without any problem? What is this happening? How it is in heaven. Actually, the data type that the array list missile ad is accepting is the type called Object. As you can see here, object is the peace for all the data types. So it's accepting strings and they turn any time. Actually, I don't want to go ahead. And And other one Ray No ad. It's more corn slice. He just mean that this is a double. OK, okay. To display the elements inside of this already we will be using four. Do we can use the normal four or the forage. Ever use the snippet to complete it so that they don't try but manually. So go ahead, choose for itch or type rich and employs one in keyword. Now we have the body of the four. Do so I've been living in the array. This is the name of the collection that I have CW this limit for the consul. The right line kept ways. We have the forms. A look right line on display. The right have displayed this. It is As you can see, fairies take 734 points. He's one. We can also use the debunk tooth easy year, the actual a list of your range so I can go ahead and fill it started by and now you put a break point. Of course from here. Now, let's go ahead and click on this adequate quits. Now the every is here. Now take a look as them moving processed. Tim, in here. Actually, let's close this. Just have this array list here to watch so that we can have a two years ago. Monitor it while the program is receiving. Do if then see now the count is one and you can seize it. The first item is first, actually again counts, too. Can you can see that it's the item. Second, again and again that we have before items inside of the array for his 2nd 34.5 As you can see, they are here. Okay, let's go ahead and continue. Please continue and let's try something different. Let's try to ensure it Something in the middle. I can go ahead and do this. I won't come here a ray dot head and just at this search for you. This is one way I can do what they announce. Added. Was there any problem? Is he here? The surge. But what if I wanted to add it later in the program or if some conditions happened? How can I do this and it in the middle? Thank you. Go ahead and use the insert. So let's display. This is the you. Definitely you at first, seed of new and just do you make my glee for you? Okay. C w a string after. I'm sorry. Sure, sure. Assertion This way. Okay. Now, let's go ahead. And for each again. Well, this would be the array. Let's not. Of course, we're get do the insert racial itself. So I'll choose. Ready And I have to be message insert. You see here insert action we takes the predators, the end, X and the value. So should the M pick that I would like to insert. That would be too soon. That's 01 to the street. Remember, the seashore of is counting forms here and the value would be certain. Let's see, w you when this Okay, it is at first. It's very seconds. Three and 4.5 Havoline after insertion for his second answer. Very easy. Okay. And I am items of where is that going to change its position? Recon, uh, in the surge position and still working normally? No. Any problem would be Austin's A number three. Yes, it is. Ok, moving on to the next. And this is an array. I can use the index off a race to access the values in society race so I can come in here and actually take this is a copy. I will be boarding the lioness for each function. Okay, so that's clear for you. So I can go ahead and CW like an axis. The arrayed by index. So remember, this is the square brackets. Two x of the M picks off. Yeah, and radio on object. So I can come in here until that they would like to access what's in and next time a leader , which is the first or the word first. So here it is. First, I can go ahead on choose no, where two and melted this too. So when I'm accessing be the word or the war, it's certain. Let's go ahead and run this. You're this certain see, so that now I can use the indexes. Max is is because of realist is actually rate. Also, we can give the capacity very easy. Do you use the capacity? I can go ahead, actually. Next. This is a copy. I can go ahead and use your raid dot com property in here. Here it is. Gets the number of the elements actually contained in the year A list. That's it. Now that's run again. And here it it's still in me that it's five. And if I move this off here before I added the number in here, so it shall be telling me that this let's just say count is make the same cookie with same fixed in here. So now I'm just getting the count a after or before I get the insert, do the insert operation. Then after that, the insert operation. So let's go ahead around this. Here is the where did the calendars four. And after a rather be keyword with ward shirt. Now the Countess five. Let's go ahead and continue. One of the very powerful missiles that I can use with the ray list is assorted. I can swerve the year rate. So if if you think if you remember when I run, this is here, it's the 1st 2nd certain. That means that's a very good short. Let's choose something different. But do you? Was the sword on the elements and this is really important. All the elements inside of the air a list must be of the same time. If I leave it like this, it will give me an error. A exception. Runtime error. Because it's not the same data types, so it can looks weird. So I will remove this members here. I will be now changing this. For example, James, David And another one. Let's add Joel is maybe my name. Okay, let's go ahead. Do the sort operation. Oh, well, you have to do with just Ray. And it is just without the s tricks. That's a keyboard in state. So let's go ahead and again for each and the collection is Ray, you just display CW Mr. Sorting, do you have new again? This blade? Okay. Just take I mentioned. Just take Elaine Muster every Greece displayed Laura Klay. Let's go ahead and run this now. Here it is. James David Charlie's mother. Even we added the number spirit in the middle now often is shorting. It's much Charlie's David James and certain this is re amazing. Okay, let's change surges, My ovary ice, Let's hear. Would choose, for example. OK, moving on with the functions weaken again. Reverse it. We can reverse see venues of the race so I can reverse it off the sorts of that. I have the sort upside down. Let's go ahead and practice. Go ahead and call off this. Actually, no, I will choose the message. Reverse changes message here after read. Worst thing. Okay, you know, I sorted it. Then I reverse it. Let's go ahead, Teoh distorting it this way. Now, after reversing, you see it's not is down. Charlie's his year. David is here. She lived in the middle because it's always in the middle five. So is I removed? The stop. The short message. You're actually that's what's double if it and let's run again Communities. It's actually Tim David Engine. This is the reverse off this thing. Here goes. It was Jim's David temp journalist without the story. Okay, so that's posed one of the very powerful missiles off very list too to reverse. Actually, you're right. Okay. What if we wanted to remove something from the every? Let's go ahead and see. How can we do this? Also, we're gonna use e you message you called remove so I can give you the obvious. Like to remove my life to remove the object Junior's. And again, let's think this is a copy for each. Let's play a message after removing, getting let's from this. And as you can see, there is no games and games was removed. So the biggest least had the James Now it this removed and all of this actually you can see here and the but boat I can again started bugging. And here it is now the list. That's go ahead. As you can see, the array here have James and that. Now, if I where to run, execute the remove aerated. Remove gyms. Now take a look at the array. James says, Okay, stop it there. I can also remove by position thinking Come up here and let Ray don't remove hat. I can deter mined and index or a position that I would like to know if I would like to remove whatever in index to index to now has room for Actually, I think it has David. Go ahead. This works. So the list should be with David? Yes, because David is at number two 01 to David is a doctor. I can't. Why? This is it also. What if we wanted dio remove all the items inside of the array? I can just simply come in here and use a clear message. Plea Messing will totally remove anything inside of the rate we're going here. It's true this Let's take this to lines here thing. Oh, bringing in now approved gold or isn't listening to this place the race totally clear. I can even use different messages. For example, this way. This one, actually the remove range. I can't choose rains rate removed so I can tell you that I would like from the one index with the search or go three three positions. So let's that's not removing full. After removing some, let's go ahead and run those snow. It would be removed from one to ST it is now. The only left is Tim. I estimate that position zero. It's really from one to wonder if I we'd use this. Make it for example to now I have two games remaining. It's Tim and but you go. I know that's a lot of message, but it's very powerful. Re amazingly easy to use. Let's go ahead and cry this last one or less to actually the contains I can go ahead and ask it that trigger asking if continents I can contain they can ask it if it contains a specific and Vatican Go ahead and radar contains. Can I ask you? Do you have this? Takes an item? What's type object? Do you have the the key Tim or the value or the object him. But go ahead and see. They believe this. It's police it inside. Okay? And this will actually contains return a ball value. So sheets ball. It's a cruel or false of the restatement will turn. No, there is no Tim. It will return forts. Here it is. It's true because Tim is they're in this list after we removed it. If ask it for deems. James Olarra was us on this list. It's false. There is no James in this list. Okay, it's mine. One less thing that I would like to do is get dreams. I can copy part of the frailest into another part of the another. Released. Let's see this so I can compete and you released. I will call it Ray List things. Let's give it up, actually, OK, so let's go ahead. And names will be from the ray that we are currently using. But we will fix it a little or just change it a little bit, so I can feel it that I would like to get strange, and the range of that will be using is one to actually to seek this. That's the old removing for our programs that we have a whole list. We're full list barrel. Let's go ahead and it's now The collection would be names that I would like to use. CW displayed the okay, and they will have a break point in Year two. He's the names and every. Let's go ahead and start the bug mode. Actually, we have older pre point here. Move it until it to continue, and I would stop in the new pre point in here. Now let's take a look at the Ray Ray have five values because I stopped older, moving statements or the code inside my program, and it's to take a look at the things names actually zero just created. It's renew now when I execute this. If you remember, this yellow here means that this still didn't execute when I executed. I'll go ahead and tell us Over, out, executed and copied. Do off. My name's here, Tim and James. But this is the positions zero starting from zero and takes too off my list, which is Tim and James as you come Sears them and gyms inculcated into the and you list, Which is things. Okay, I run this almost reading. Here it is. It's still an drums. I just didn't have the decline here. Well, the things okay? No, I know that was the a lot of messages, but it's very powerful, if you think if it And if you were to do this, you think the normal arrays will take you a lot of time. It will take a lot of hard work trying to do the sorting and removing and reversing in the adding, removing its It's a lot of work, but here is was the radius you can do within a blink of an eye, so I hope you enjoy it, and that's it. Seems the next video 4. Hashtable: we're still discussing the Nun Generi collections and slicked er. We will be discussing hash tables. Much table actually represented collection off a king and value pairs of organized based on the hash code off the key. So there is a key and the value There is some points here Do not, as about the hash tables hash people, the stores G value appearance of any data time. The key must be unique and cannot be known. Value, on the other hand, can be know what can be duplicated without any problems. Value can be off any time. Let's go ahead and see this and teacher first. Let's go ahead and and the name space system look collections and let's go ahead and create the Hess David. I call it ties, and it's not every meaningful instance name, but just for the simplicity, Okay, now have created our first and stable successfully. Let's go ahead and try to answer items so a French and again the message add that actually takes to hey perimeters the king and the valve. So here is the key. Here is the value. It's incur the and again it's takes object so it can be if any time as you can see here, just move this. It's subject an object. So I was interview example This drink. I would call this my crew. It's all split into some companies in here, and it is on American company on the gun. Steve. Old ad You don't choose funny. And yours the firm maybe something different this time. Like here. The furniture company. It's We didn't unless you hear. Maybe no status. And of course it is. Germany. Don't leave. Added four elements inside of this hash here, the Microsoft Cezanne in Japan like a sweet and man more status Germany. How can we display this? You can go ahead and use for each the place for the snippet and the collection would be the hash. But here is one thing to remember. We need to change this void here because voyage gonna work with us. So we need to change it to type called dictionary entry. Okay, so let's go ahead. Cw The item, which is oft I have dictionary entry. Now it's asking me, Do you like to display the value or the keep? So first, I would like to display the key. The native is we value time? Well, you okay, Let's go ahead and underst any riches. The i k MRC. It is Microsoft Sony, and it's sorted Paste a bomb, the hash code off the hash. David, as we mentioned in the presentation. Okay, let's go ahead and try to get the capacity off and stable. Actually, it's really simple. We could go ahead and form so trying it one of the trade playing it as the accountant again . Just remember in year Enamel is from there it is Countess foreign Sports added, removed anything it will be and why did, to remove the value from the as table. It's actually very simple. We can go ahead and fill it as we move, and I just give them the key so I can give it, for example, like, Yeah, let's go ahead, right? We'll live through this again one time only wound. Let's display a message CW. We'll store moving. See that you just playing message in here or line okay from this. And then here it is after we moved. Okay, I can. Then we have more situs like ourselves to Anthony. Continue the functions that we can do. Also, we can ask about a specific E or e value inside. He has table itself so I can come in here for us. Just at this moment in here. Hey, contains tradition. Now, let's go ahead and ask it. It's called hash docked contains and contains. If you remember like the rate list, it's a pool. It return straw fall. So last kids, you see it needs a key, and I can ask about the key. They're sunny, for example. I can even place it insulated if condition of destroy can make it like this. True. This is the same as this. Like that. Well, here it is. C. W and yes, the collection as something. Okay, the pills, the no kids does. No. Have it from this. It is. Must have happened. Bacos, we need to, uh, actually the bug. This actually see whites started bugging. It is something is wrong with the application itself. So in case of you run into one of this errors here, we can come in here and rebuild distribution. Rebuilding? Remember? Well, gleaning distributions of build it again. So we build it grand. Let's try and run this. It is Yes. The collection has some. You see, it was nothing wrong with the code. Just some a compiling issue with visual studio show. When you run into something like this when you're sure that you could is totally valid and it should be displaying something, go ahead and cleans a project or repeal distribution. OK, so let's make it search for a different one tomorrow. Also the Japanese company, I guess. But it's looking our list. Go ahead and numbness and it doesn't. Okay. Okay, well, let's see. I can copy the hash table values into an array list. Can you do this? And it's very easy. May be easier than you think. I can go ahead and define an array list. What was Ray you? And and and for each warmed, the collection will be arraigned CW and this blade. What? I can only Kobe the values for the keys. In this case, I will be called being the keys on. So all you have to do is in the initialization of the array in here, the constructor handle that he has no Ellie is pass it to the constructor of the message of the array list here, which takes an inter fees called collection and tennis values. Actually, it's time my collection interface collections. Let's go ahead and run this. Now we're working with rape and displaying it and maybe just display this year. Stir copying. It's from this on here. It ISS start copying. You have Germany, you see those were removed. I can't from here. Actually elevate here. Let's get it back. Let's stop scored and then again on. And the rarest should have. We do. You can also try to make this with the keys only because the frailest actually take only one. There is no keys or values and ray list. It's either e value or case. Today's like AM or see this some Let's sing for you go the this must be the year we can work with something different that contains you can use. It contains value. I can ask about the specific value If Japan, for example, has he. Cos yes, Jeff is included, Bill. It is net from this, and here is a message Yes, included. Now I ask it about the value itself of the key. Let's go ahead and ask about China. No, it's not. So that's it about the hash tables, very helpful, and you can use it in some situations. So that said to you in the next lecture 5. SortedList: Now it's time with another collection. Time, which is sorted list sort of list, actually represents a collection off a king in value, a pair that are sorted by the keys. There is a generic Patman generic sorted lists. Shortlist actually store the key value pairs in ascending order of the key. So it's short. It automatically that you're doing anything. He must be unique and cannot be no the same as he has. Table value can be no duplicated, the same as that stable. Also, value can be off any time as well. Let's go ahead and see this annex. Go ahead and include the just collections. And in here I'll be creating these sorted lists. Cool it sort of gins, just re appeasing, naming for clarity. Your life will name it. Anything else. Go ahead. Now we have the list. Let's go ahead and at my terms, anything I turns like this. Actually, I can. In the previous lectures when we were discussing the hash tables, I use strings. Now I will be using numbers for the on into one and maybe mostly Gen January Jones to and February three Wash adds some more. And for that girl on May this first. Okay, now we have successfully created first sort of list. Let's go ahead and take a look at it into debugging mood before we do anything. I have them. Priest break point and story and let's take a look at this requests. And it is the last one. Didn't you to January really nourish and April lives actually cute. This one actually again added to the Edwards. Here's let's run, learn. There we have the account. Well, as you can see here it ISS Let's go ahead and right to display this can see how it will be displayed first over you the forage through forage and use a snippet That place. And it was, uh, collection sort of list. They'll see. Don't you wards play the item? I hadn't done this, and actually, you see here is a dictionary entry because they told you, you need to change this for two dictionary entry. And here the item will be choosing that key here. Get a native with the returned value. That's why the border keyword can report. We need to use a dictionary entry with the for each because it was the four Lovett's I have to run this your days, Jan. February, Morris, April and may. Okay, it's cool. Sort of list out. Sorted it sort at. We mentioned that the presentation with the he lets try to change this keys. I will make this 10. Let's go ahead and run this. Let me doing anything. Now It's downs a list because 10 is greater than all of this. You see, it's sort of it without me doing anything. Even if I wanted to run this into the bargain mood again and he reduced, you see, began here in the structure inside the seizure of itself. It's down here, another the first. So that's why it's called. It's short listed to go ahead and make it one. Move the break point. Its continue. Let's go ahead and try to display this with Number four. For In the body. It's be sure Good list Leiterman's or caroms actually rounding here. Jozy, console the right line. Don't be displaying the shorted list. You use a message called Get Key and it will take him Endlich. So given the I and again donated to display the same as the reviews for each, it is short of lists duck now to display the value itself. Get actually value. Get by Alex Nearness. Get my antics now with urine and when again. Here it is is with the four th And this was a four loop. So you choose whatever. So it's year with two options forage and four. We also can access the appendix off this so I can come in here and feel its heat. If you we can access the sort of list with the index, I can access the index number, for example. And just over just a string. And on this number do I think it's February? If so, I hadn't run this. Yes, it's very change it. And access, for example, lives from this and do this, they hold your presentation. We cannot have a duplicate varies if I make this one again when we have two ones in here. The Janet February's is, of course, is wronging counting. But let's try this. This will give me an exception from time. Here it is, right, I'm ready. Being added to totally not you. But on the other hand, I can make duplicate off this here so I can rub this. Then we have been two times again. This is logically one. But it is. It's acceptable. And even the long we can have lo here that's not acceptable again. We're in this run into an exception. Hold key. Cannot be. No, we can have the it's exceptions of this can be No. We're gonna make this mold running in. It is the 1st 1 is my land. Here's your Okay. So this is this is a difference between the key and the value. I was continue to display some of this messages in here. So Consulate Frontline, I think you are now from here with it to get the count. You have the property count now on this and the count is five becoming very easy for year, I guess. Let's go ahead and try to remove something from the list. So the shorted list looked removed. We can use to remove that and could give it an index of removed 61 which is very and you're gonna have them take a look at this. Now let's go ahead on this plate can take a look at the bucking mood or we can just display this plate. And now there is no if it were right. I can't even move it by the name so I can come here and that they would like to use the other remove message, which takes the key, and they will tell it to remove the key. Actually, it's every time removed one. Now that's not mechanics, that the key one, which is January. Now it's removed. We have your January sign to number two. I had that fix it. It should be okay. Remember that changed it little. We also can use the contains that we have seen before. Also, go ahead and council line. Now choose the sorted list of contains. We can choose the value of the key. I will go ahead for the value, no less. You have, you know, on this street people's because we don't have it on this. If I added, for example, it really right now it's goes. We have a really at least one last visit here we can copy the array list could be the sorted list to the array list. As we have seen with the hash table. We can come in here and they find in your endless they call it a ray and that doesn't ray less. Not just a rate, ray equal. New, reckless. In the inside of the message here is a constructor coming here and that that I would like to take the sort of list. But I need to do foreign, which I will be taking keys. We're values. Remember that the realist cannot have the key, and values can have only one of them. So I don't think the values don't come in here and or each I will be moving through the arrange and displaying it. So display the item and just this Play a message. Here. You Now we are inside. Be rainless. Okay. Go ahead. Around this it isn't and we're inside the ray list. We have February more. Ship will remember that we remove the 1st 1 in here. Go ahead and stop this code. And from there we will have January where it is. Okay, so that's it about the sorted list. All right, things, your ah, it's familiar with the or very similar to be, uh, has stable going that this is sorted automatically user to doing anything. So see you in the next lectures 6. Stacks: We're still discussing the nun Generi collections. And then this lecture will be discussing stacks. Thank Actually represents a concept cold last in first out collection of objects. You lie. So what does this mean? If I have a stack here and elements are added this weight What? I started getting out this elements, the last one that has added will be the 1st 1 to get out. Like this way. Famous example of this stack concept is this steak of boxes. The less handed box will be the 1st 1 Get up heuristics coins, for example. C sharp actually have the same concept. So let's go ahead and see How can we do this? I actually have the collection name space included. So I will go ahead then directly to be sticks and the glasses. Gold sticks present. See? As you can see, he symbol lest in first out none generi collection of objects bullets tag you and even strip. Okay, now it's created successfully Mistake. Let's go ahead and see How can we create had things inside of the state To add things inside of the stack, we use the keyword push hesitancy here so inserts an object at the top of this. Go ahead and an object Let, for example, means it's at think it. It's a stack of things. David was the 1st 1 to race. Now let's add a little one. Bush have his way, for example, Would be, I mean, but maybe their kid Jang humans. It is the family made me but one. You have another daughter called me and them off with the mother. So let's actually think this indeed. Bugging. Celebrate. Please break pointing here and start and editing the Here it is. Here is moist. Drag him and David and actually be Emma. I didn't know added when I executed it. Here it is in my bank. I mean, okay, you see here Emma is at the top and David at the bottom here because he was had it first. So when we are trying to get things out of this attack here, and it would be the 1st 1 to get out, Jack would be the second. Amy would be the surge and David would be the last. So the first I mean, would be the last out. Okay, let's go ahead and try. Get this out of the state. Actually, let's we'll go ahead in this place. No. Oh, play this. We pick only this. Remove this. Get to go ahead. And from this 1st 1 would be Emma and see. Do it again. The next one. Can you guess it? It's Jack, Amy and David. Go ahead, friend. That bugging it is him a giant. Can me David. So death in the most tax? I think it's pretty easy issues of the hash table land realists. It has some of its uses on, and that's a teams the next picture. 7. Queues: and this lecture we will be discussing and as a nun, Generi collection, which is cues, was actually ovary symbol. Your absence, he concept first in first out collection for object, which means that assume that we have this you here, so be crown or the thread box came first will be the 1st 1 to get out, then the green and the purple and lest the loop, it's the opposite off the stats. If you remember the stack, the blue would be the one to get out first because it's less than first. Now he's actually works in the public it way. Famous example of this is accused people waiting for a concert ticket or E at the import. For example, This person here, the 1st 1 to came, would be the 1st 1 to get out of this life. Okay, let's go ahead and see. How can we do this and see sure I have the collection name space included, so I go ahead and directly music. You, us, your dear. They call with Q clone you, you, and let's go ahead and that items to the Q. Giving the message. Thank you. Here is a description at an object to the end of the queue. Yes, let's add an object, for example. Make it names, uh, and then can be. Maybe I'm out again, and that's it. I can go ahead and lose this queue for each que to give the items inside of it and read the item. Go ahead on from this. It is even torment to remove it or dick you with. Actually, it's very simple. That's to the cure. The instance Name and start Dick Ewing. Them actually be displaying this as well. Okay, it is that Swim this now. It would be caving here. The 1st 1 though he was the first 12 came. So it's the 1st 1 he served. Give him you this. And you this one again it is. Hey, drinking first Tom, then Emma. Now, even Ah, When Forest Service first and Tom. Thanks. Very symbol. Even simpler than this tax. So that's empty. And the next pictures 8. BitArray: Welcome back In this lecture we will be discussing some unique and different Londonderry collection. It is the pit array, but they re actually represent a compact, a rave values which are presented as Pullman's. Like this example. In here it's just a list or an array of zeros and ones. So we'll go ahead and do this and see sharp. I would like you to remember the and operator that we've discussed and theological of greater lectures. Remember that this will give us this result 00 would give us zero 01 will give us zero also because one of the conditions did not happen or that achieve marlins You also give us Here is the only kids that we will have this one or true when the two conditions are happening on the other hand, or works in a different way Did a and zero give us here because none of the condition happened, dear On one will give us one woman's You will give us 11 and one. Give us what? Okay, go ahead and see. How could we do this in teacher? Actually, I have the collection here included, so I don't have to include anything. Now let's go have and create first great ankle with the rate and we've created it successfully that successfully. Actually, you don't need to specify the size like until it It's array foreign over the years gun where you can do it differently. I will call this, for example, furs to rain on the create Another one sickened Ray and I will deformed this in a different way. Just leave the air legs convenient was me, uh, and a ready off pools of life to go ahead and do this manually. The manual way there won't go ahead. We'll get it. Like to create well, array. No cold will array it won't you Well off. Four have created manually and raves. Well, the in value Let's go ahead and set it So the Cool Ray. And next year we, for example, fools Wilmore. One would be fools to be fools. You would be true. Let's go ahead and we can set here that this bit array will take the reigning both bull veil Woolery. So now this is another way to create. The rates are 1st 1 we can go ahead and community just set the limits offense and the second way that we can go ahead and said the constructor through e men will a ray off pool that we've created manually in here. Now let's go ahead and set the first airway. So Valley. So the first array I can go ahead and through the mess of gold said. And as you can see here, it's telling me the appendix I would choose, for example, zero and zero, and the value would be, for example, fools. And take this copy now again changes a position. But the index, maybe Children value to doing this. So we have the same the rays and created an E different techniques. Can we display this? That's actually very easy. We can go ahead and use E for each. From here, I can choose the collection from that on the first array. Go ahead. And this way the item from this it is falls holds false. True only changes, for example, make this to it's run again. They will have to force is to truth. As you can see in here can also for the 2nd 1 2nd 1 actually has three fools and one trip from this. Here it is three fold. There is some functions here that we can use in the bit array to simulate the work off the end and or and not Raiders. Actually, when you first to create and you that's created and it's a practice to created in your actually with of a bitter raised. But I'll be creating it here just to make clear they call this result. I don't think this rave for also this ray will contain the result off just first and second rate. When we're doing the and and Or and Not operators took, I'll cover that. The results equal the first ray, and here we can find a message. Cold hands, as you can see in here. In the end, actually take a little bit of Rain Boy and Philip that it's these second rate. Now it will do the work off the hand in combat. We having folds and folds were Give us falls bold and forceful. US fools, fools and true will give us Fuld's to Andrew will give us true. So let's run this anti of this work, actually, over results like to display the item. Prince here displayed e message forwards. Okay, it's when this. And here it is fulls, fold schools and only one a stroke. Because this is true and stroller Try to make this true 1st 1 And this, I think Go ahead and then we have True Andrew because the 1st 1 of the first of ring in the 1st 1 of the second Array, what was true? So that's how we can do the and greater Let's go ahead and try the or operator. Let's go ahead and take this copy. All this can go ahead and that this is the or greater. It's also a message in the array and for this war and again, this here it is, actually, let's changes of values of it. But we have. This is full. So falls as you can see, hand loomed the perfect. Maybe we link this Who this is true into the fools. The last one. So all of them should be true, except for the last one. Okay, go ahead and run this and actually it's not working correctly. Maybe you need to stop this in here just to make a bit of practice. Don't you? The same. Okay, systems. So let's go ahead and running and they were training correctly. Okay, so here we have the true and true. It's true, true and true. It's true. Full Centro stroll, but falls and falls. It's totally Willis saying we can try the not a greater actually. Stop this one also, and they can. Here we'll become unjust. Take it. Copy and paste. Now we can you the not a preacher it is, and you can go ahead and the greater and this is actually the not. If you remember, it's the opposite off every value. So we are getting the opposite off the first array. So the first Ray has true, true, true false male. It should be false, false, false and true. But you go ahead and run this and here it is fools, fools, fools truth and the first, this destroying make this fall's cool fools. And then we have four forces, and then when we won days, we will have four truth. Here it is. So this is about the best of rare. You know, it's not a commonly used, but maybe you will need to use it and some kind of scenario you have in the future. So that's it. CNN's the next lecture 9. List of Animals and Trainers Exercise: Now it's time for an exercise this exercise. I would like you to go ahead and do the following to meet the structure called animals and another uncle. Trainers. Anyone structure should contain one variable called name and the property with same named low access to this private field. Animals also should continue to messages called say, high end feed training is structured contained one variable called trainer name and property was the same name. Also, to give access to this private variable, trainers structured contained one message cold. Say hi and we're heading creates, for instance, the annual district and one of the trainers Late one array list and try to add this three animals that you've just created in distance off it to the list. Now look through the list with the different animals and cold, unless it's a high for each instance off the street instances now, go ahead and add C trainer in distance to the array list. Now try to look through the list, which now contains different structures, animals and creatures. Okay, most of video and tried to do this in your okay. I hope this was easy. Let's go ahead and try to do it together. You're a heavy file with the requirements. You will also find it in your projects. A folder. Now let's go ahead and try to take it. One. Play one. Here is the 1st 3 strikes called animals and another one cool treat. Let's go ahead and outside of the class program. Let's go ahead and truck animals and everyone. Okay, Cleaners. Rainer's Let's go matching the next one Animal district should continue on variable cold name and property was the same name. Let's go ahead and use this never full place. It isn't that we can go ahead and choose data type, which is Stop string M V verbally. My bullet only name and the property would be of the same name on three animal structured, contained to a message Say hi and feet It will be displaying only symbol messages. So the 1st 1 say hi. Hey, my C W twice We have direct line in here. Well, that's a Lou. My name is like the animal is talking. Yes, my name is you're bending and create the explicit. We'll see wise for for you T w don't try to name now. Heating. Okay, now that's another one done. We can go ahead and trainer structure containing on variable old her name. We can go ahead now with the trainer strict and guys. It is string schooled. Train your name, as you can see as I'm changing the name here. The name here, changing roles. Add the name of the property. Weiner name with a Capital T and M. Let's go ahead to the next trainer. Structured Contained. One missile cold. Say hi again. Let's do this would say Hi with streaks you don't do Just just blame us. Inch, Helou. I am the new greener the next. Now let's go and create three instance of this animal district on one of the trainers. Go ahead to the main message here will be creating animals. The first would be bogged. Moving well, new on outfits. Dog name, too. On the next one on the road, they call this cat. Maybe I'll give it thing you see sounds. I love elephants. Any role? It's just very basic. You can go ahead and choose any animal. You there? I don't have a lame for ships and maybe full name Fouzi. Okay, now let's go ahead. And maybe trainers Weiner Well knew. You know, just give it a name. Don't. And this is the name of the innocents, remember? Drawn in her name. John. Next may. Gauging. Okay, now let's see what we have. A list. So now to the reels in create one ray list and address re animals to this list to use. Eat at Rennes. We need to include the elections in here we have the name space. So go ahead and created a rail list here. I call it, for example, least you know And then we have the least they'll start having least at the dog first. I love cats. I hoped I don't have to get. Doesn't make any problems. Hello From Spurs. OK, now we have created a realist with different Aniston's Overbey class animals. You can go ahead and now is he file now? We need toe loop through the list Was different animals and called to say hi, Mrs. Let's do this. You the forage you four item in collection, please. I'll see you and use actually just on this play this great. Do you want the items? Okay. When this just testing here it is. Actually the item contains e animals glass G Genoa. I can't Texas. They cannot Ex Excuse me. Any of the names was a message. So how can I do this coming here and cast this Here, do this stuff. Animals and forget Prince East. Now this is converted to animals. Now I have access to the name and say hi message like this. Okay, actually, that. Just make sure that this is working. We need everyone. What? Um, like this. This should work and say hi to meet just removed. No need. Say I actually display the You can't. This was here. No need to place it inside a CD. Okay, Now, let's go ahead and win this. Here it is. Hello. My name is Max, Lucy and Rafi. So that's one way to do what we can come in here and changes for and make it animals. Actually, just go ahead, hold down the item that we have access to it. That's easier. I guess it is. Hello. My name is Excellency. And, of course, if I change this very duty, that's 20 games for an elephant. That's what I have in my mind. So now let's see what's under filed. Now we have to have the trainer in distance to the list. Okay, that's that's weird. But actually, before I go ahead and do this, I would like to please. Yeah, three point in here and try to see what's on this list into the bugging. Okay. Started. Bugel mode. Now, what's killing the list now? Over list. You're have 3 a.m. Dear old, off type animals, animals. Access any of them. Really Name variable in. Now let's go ahead and try to have the pink. Please do remember that the and realist allow you to head. He needed to talk so it will look complain about that. This is a different, less so hit restricted John it is now it's running again into the bugging. Wrote to check the array list. Now it is now the list have four items and as you can see, animals, animals, animals and the last item trainers. But this will give me an error. Let's go ahead and run this and here it is. Specified. Cast is not valid because the last one Jordan here is not an animal is not classes drink. Okay. I mean, that's that's to John. But that's the only programming. It's not like animals. It's type printers. So how can we solve this issue? That's one of the problems in this exercise. So beautiful. Let's make this before again. So is it It's not if the mind I'm Actually, it's leave this that I don't go ahead and ask if the time off trying to get the time off animals in here. So this is a glass. Now I'm getting the time off. Will equal the time off fightin when there is a message called Get time which returns the time I can't taxes or ask the compiler a teacher If this is off, try petrol. If this item here, when you're looping off type animals and maybe use, I tell no, they should be disgusted. Any molds by Tim No, we can access and say hi. On the feed you it is okay. But otherwise, if that's not the class and e mails, you can go ahead and let's take this three here. That's Captain converted to e cleaners strict and gold to say hi again. Now let's run this And yes, it solve it. Hello. My name is Max Makes and I was eating Hello. My name is Lucy. Lucy now has 18. Hello. My name is movie. Well, he knows eating Hello. I am than you trainer. So this year's over the problem off the different glasses inside of the Israelis that we have. Okay. I hope this was fun. That's it to you in the next lectures. 10. Lists: Welcome back in this lecture we would be creating are for his generic collection, which is the list. The T here actually represents the genetic. So when you see this, the litter anywhere this mean that you will be dealing with a generic type list actually is the same as the array list the Nun generic Ray list. Except that the list is a generic collection, which means that its stores elements off the C five type. Unlike the array list, if you remember a realistic can store different elements of different data times. It also grows and shrinks automatically. It can store multiple null or duplicated elements that can be accessed using indexer or the four or before each statements off course. It's high ideal for storing and retrieving a large number of elements. Three. Fast. So let's go ahead and see How can we do this? And teacher, make sure that you have this name space here. System collections, you know. Now let's go ahead and create the first list. Sometimes the wordless on a do this, uh, symbols or brackets in here and make sure that, um, that the type of the list, for example, I would be drink and example, or maybe string. I'll call this first list. Um, now we have created our first generic. I can go ahead and find another one using a different technique. You can go ahead and use I list and they will make this also string. I pulled the second this on you this string one currencies And then we have created our first so generic lists you can created using the list or the I list. Now let's start and ants of items were used. The first list the add message here at an object with the end of the list. Go ahead and at, for example, it's and countries in England, firstly still have hungry. Maybe Serena. And one more groans but Germany. Okay, June display. Actually the least That's very easy. You have seen this many times. You can use the four other for your child. Be using Z for each. What is the collection would be old. Firstly stands He didn't leave. We're displaying it. Be displaying the item. Go ahead, run! This here is our values. As you can see, England Really China. Germany. I can even access this by an M picks as long as it's and a rate of the paintings or the concept is an array. So I can go ahead and access. For example, the first list using the EM Index zero. I can display this. Let's go ahead of displaying from Zamboanga were too, which is China. It is that we have try nine here after we displayed or or the list. I can even a swing if I can go ahead and change it. Cam local, This here I will change well China to, for example, Korea. So screen Good. Now we have South Korea. We change it. And actually, if I run down before you changing the hell you told me so here it is. I'm doing before Luke again offer changes the value of the index to you know it is. We have England hungry. South Korea. German looked like the first run. We have England hungry China, Germany. Okay, let's actually go to the next one. We can, of course, use the count to get the current off the it is so I can feel it that the count is to give the capacity and from this and her discounts for they added one more maybe a lab for him. We have one more now. It's funny. Okay. Same Every released. We have these words. Mess with you here. Go ahead and tell it that the first place for sounds like you just you're just a message after sporting. Oh God, I have to take the four loop copy again to speed things up. Go ahead and roll days now off asserting its Egypt, England, Germany hungry answers Korea those. It's sort of most critically. You can go ahead and reverse it. Actually do the same. Take all of this with the copy. Baste it in here. Go ahead off the resorted. If we can go ahead and read, reversing a reversing and choosy message. Reverse. Worse it is. Now let's run it again now it would be upside down. We have just reversing its South Korea hungry Germany, England, Egypt and with the sorted one. Okay, so it's ready. Basic. Very easy. As we have seen, the array list tree can remove also items from here, so let's go ahead on and it does. For example, it's actually the lining here it is off moving, and now I can use you remove less abs have actually remove Miss it here and it takes a string. I can go ahead and remove, for example Germany. Oh, I can take the four. Live again. Baste it in here All the trend this and three years off moving. We don't have Germany anymore And like, and even get the counts again. No, we have to count against from the killed. Should be now is give you list the first lay stop before it is now It's for If I removed the even one more item using different remove missiles like the I can go ahead and specify the ethics. I would be removing the index moment zero and this is the zero after. We just sorted and reverse city list here, So it should be so. His career Here it is because this was reversed sort of. Then reverse it. If I stop the reversing, I want you in Here it is. Now it's South Korea. We have South Korea, but we removed Egypt. There is no reversing. We have sort of dip. And Egypt is the first and drinking Z list. Just the very basic methods we have seen them before. We can go ahead. Actually there is one, actually, uh, here it is. The Rizzi remove range. Here I can sign. Arrange, for example, to sort of Theroux and built to resemble two or ST before even 20. If I have a long list, remove the items in this list we can go ahead and remove them all. Like seen before the clear actually were totally clear the list for us. But I don't want to do this. I love it. Just leave even quantum. But I can use the contain. Miss it. Actually, it's helpfully can go ahead and ask if t first contains that you string for example like you do what to go ahead. And this. What do you think this will give us roomfuls? Let's get here alone, idiot! Stay focused. Tell me what you will think this gives through fools. Actually, this will give us fools way this because we stop this missile in here now we don't have Egypt. People is at the top of the list and we don't move the top of the list. If I reverse this here now, Egypt will be at the bottom of the list. And this one This one actually. Now let's from this. You know, it's true because Egypt there and we removed screen. OK, the last thing that we can a copy this list. Remember that We have two lists first and second. We've created them at the start. We can go ahead. And so that the first list Okay, the message get range, it will be is reminding the public starts from the euro. Take two and get the range. And we can assign this into the I'm list. They can go ahead playing this from the second list pulling the now we or in the second this actually wrote this forage. Now we will be working with the second list on c w be creating were just displaying, right. It's where had found us and we have the then we are in the list hungry. And England those. We only took two items of this list. We can go ahead and at one more and we Egypt as well and it's was the list help. Okay, I know that's a lot of messages, but the every basics, they're very easy to use this thing. I hope this was helpful and see you in the next lectures. 11. Dictionary: Now it's time for a legendary collection. It is The dictionary dictionary actually stored the data as a key value pair. The same as the non generic collection has stable that we've discussed for years. Let's go ahead and see How can we do this incision? So before we started, make sure that you have this name. Space included. The system, the collections LodgeNet. Now, let's go ahead. I'm trying to create the first dictionary. Go ahead on time Dictionary. Here is intelligence giving us the descriptions, telling us that it represents a collection off skis and values. You haven't use it, you know. I'm asking too. Did the mind the type off, the G and the value will be entering string and street. Okay, so here is the type of the key and the time off. Very. Go ahead and give it a name. Capitals, and just she'll isn't like this. Now we've successfully created off first, right? Let's go ahead and try to add items. Do this. Okay. So don't worry about this creating with specializations, we will be doing this letter. Let's go ahead and use e publisher Mrs Ad to start having items do the generic used. Actually, as you can see here we have a king and we have a value and they are the same time. So they just desert mind in here. So it's keep string on the value of a string. Que me and change this and make it in King. It was automatic leaders slipped in here. So as you can see now we have the key stipend and even I change it. Vending. Maybe make it the date time. It will again reflect in here. As you can see, we have a value off date, time and key. Actually, I'm going to use string. Okay, I will be adding and countries and the capital of speech. Well, maybe Russia. Your World Cup is at the doors. Do you think will win this work? Then make your ends. Moscow, the capital. Greed. A couple more. I changed the values. And Italy? England one done, maybe from, um Okay. In order of size, Germany were left. Okay, I was just really had some data or records into the dictionary. Let's go ahead and display this. What is it? First in the debugging. So I'll add a break point in here and go ahead and start into the bottle. Mood Stop! 20 point now. This statement is natural executed. So if I hover over the capitals that you can see now it's telling me that I have only four . This line still did not execute. So I go ahead. Empress. Attempt. Excuse. This Brooklyn is about to be terminated. But I will go up in here now. The capital should be. But if we open this, we have our didn't here. So if I over example England Well, tell me that Dickie is England on the value is London. So this is how it is structured inside of the sea. Go ahead and remove this break point. No, let's go ahead and try to display this using Z for each. Go ahead and choose a snippet forever. Each collection capitals they used to once on the flight line again, I'll be displaying. What do you think will be displaying on the screen? So I leave the item, the key or the value not to go ahead and see this. Actually, it would display also that we got I didn't get a mind. I want to the key or the values displayed the whole the treasury and every record eluding the key. But I can come here and the mind that I was lying from bamboo. You run this because we have value. Change it to the king his Then we have to keep. Okay, let's go ahead and try to do this using normal for not before. So I go ahead and plans to be the body of before. And here it is. It needs a lens. The lens. We can get it from kept ALS count property. It does get the number of the key value pairs. Now we have Okay, We cannot use the item that key or value inside of this for Luke, those that's only available for the fort each when we created the four item here. So what we're gonna do? How can we display the items inside of this dictionary? It's very easy. We can go ahead and see doubly this and there is a property. Actually, cold King is in here and inside of keys there is you miss it. We can use cold element. I can go ahead. So have the eyes increasing for 01 So it's iterating through the dictionary as we have seen this before in loping. Okay, let's go ahead on display. This here it is. Now we can get the he's out of the dictionary using do nobody or look, we can also use this. We can go ahead and like to get the values. Oh, a dictionary and values. And there is another way actually that I can get it with. I can go ahead and do this until it's Ricky. It's explained. This is a gringo. Had this dead the indexed. I'm telling it to access this value, so go ahead. Actually, that's right. We need to enter here because we're accessing the dictionary by the King Won't defend. Go ahead and run this. Here it is. This is the same as I drive this. For example here Germany, This will give us. I'm telling it to access the value off the key Germany. So this will give us Berlin or Spain, which in this case would give us migrate won't have much reach lifetimes ago. It's inside Fallujah on the same as for Germany. People have left. Okay, so well, we just did that. They had placed this fix it or start exchanging here by this This is getting me the kidneys dynamically. So when the light changes now it's reading through the A dictionary and giving me different values. H g Okay. No, we can access this also using ethnic. So we can Is this here the same as above? Go ahead. Capitals can like in access for sure it is. They have most were after all those are released. We have won. Let's go here we go ahead and stop this. It's more You can add a line that's not just started. Just go ahead and at the line in here. Safe it again. Here just we have Moscow. If I change the and keep here maybe Italy again, we will have Well, you can even change the value. Go ahead. And the capitals? I don't change. Is he maybe equally okay Change the value he Italy on making, for example that so I'm changing the capital off Italy. Divinity, Now this line here we give us when it's not true because William is girl and we have Venice , as you can see. And this eye were to make a loop again. Here there is no road school. London, Madrid. It's totally place by the Why did this? And we have seen how to get the capacity using the property count. Let's try this this actually in humans. And he tried to get that. Let's go ahead and we'll have capitals. And there is a message cold, trying advantage. This is actually returns bulls. So if the value exists, it will get me the value. If it doesn't, it wouldn't give me. Okay, So go ahead and choose it. It's telling me that it needs a key and event. Let's go ahead and give it, for example, he Germany. So is Germany existed? Give me the value off the keep. We'll go ahead and use out, out actually have seen our before string finding that you variable here. And if the value is the variable is available, the key is available inside of this dictionary. It will be our or assigned to this new variable results in here. So go ahead. And this play the result years old is from this We have Germany in artists, so we should have lent. Okay, let's do some things. That's not maybe friends. Now we don't have friends in all this, So the result is well, see, it's go ahead and form this. We can go ahead. Do this. His old not equal. So run this when incident. Go ahead. Now you don't see no results displayed. Enter some things that I have for sure. My dictionary. Now it will be visible. Very interesting. We can go ahead, of course, and remove items very easily using the movement. So here it is. I'm gonna have end of the mind key. Go ahead, Italy. After we Children heavy. So we moved it. You can go ahead and move it again. Caesar result. But at least after its move, like just to display the when. Here it is just to make it clear for this place looking. It's from this, you know it is. We have only four records in the dictionary. That's five records. Italy was removed. Get the count even don't you now is it looked enemy. Now it's four. Okay, I can even coming here and we move it old if I need to clear its with a reason. Like and go ahead and clear the dictionary. And as you can see, the description here removes old keys and values. Now the list collection near is totally clear. All right. Wanted to get the count again. Here. I will not have any. It's the countess here because all of the items were removed of this. No one last function that we're all so familiar with Kinsey contains. Go ahead and ask. Does the dictionary if it has some value? Sorry. Not this. Chemicals contain Cain. All they can ask it if it has, for example, England. If there's England, this will give me true. Here it is. If I give it something that I don't have on the list. Like for example, France again. Now still is this false? We don't have friends on this. Okay, time forget. Before we go, we need to look up here and see this creating with initialization. So what was this creating with initialization? I can come here and define in your dictionary. I'll make it for example. Genes are the key. Would be enough were and three value would be a street. My gold is, for example, maybe names. Have you dictionary of the different about this different is that I can come in here and a sign values Do this dictionary like this. Wait. Come here and ask for example, the 1st 1 would be so it would be one. Maybe drinks on secreted boycotts with the values I am adding values. Well, im initializing And, of course, duplicated is not allowed. One. This Merrill. It's giving me errors in your exception on item with the same key really had it. So I have to change keep, but I can have the same value. The problem so I can go ahead is Jack. Maybe which is okay, and we have values. I can come in here blew through this new collection that they've just created that's cold rooms and be displaying the why to don't It is, We have It is It's at the first James Jack and okay, that's every neat way to define for July's various off the cherry. So that said about dictionaries, I hope that this is fun and easy to you. In the next lectures 12. Generic SortedList: In this lecture, we will be discussing a new generic collection, which is sort of list. But wait a minute. Didn't we discussed the sorted list saying before? Yes, we did. But it was the non generic sorted list, and I told you that there is none generic and generic sort of list with the same thing for the list, actually representing collection of a key value. Pairs are sorted automatically in ascending order of the without you doing. As I mentioned, there is a generic and non generic sort of list, and we will see if it and we actually discussing under during sorted list previously. But we will see how how it's different from the source of list is your starting list, like he must be unique and kind of be known the same as most of the collections the value can you know or duplicated without any problem. Also the same as most of the collections, you know, sort of list stores, a key and value of specifically data science. You're not allowed to use multiple elements off different of the times inside one list. Let's go ahead and see How can we do this and see sure. Make sure that you have the system of collections, name space and the system with collections generic. Actually, this one is here, buddy, but make sure that it's not removed. Okay, let's go ahead and try to create the London X two lists or go ahead on and sort of list here. Is he engineering sort of list? Actually, I would like you to notice something. Look at this here. It's no great out because I did not use any of this name spaces. Once I choose this sort of list, it will turn black. It is. It's telling me that now I'm using one. The classes inside of this name Space College, for example. Keep it general. And now we've created some generic none very short list. Everything. Go ahead and start working with this. And we have seen this before, actually, in a whole lecture. But this lecture is about the generic sort of lists. Let's go ahead and try to climb Z merits or the list. It's here now. When I started using it, the generic names baseballs were in black. Here it is week. Carrie, it's get right now. There is Okay. I will give it a value I need to define off course. This is the same as the dictionary I needed to form the type of the king and the time of the event. So and strained. Then I'll call this maybe for book will be competing, armed, created, see generics list and course. You can see the difference between Generic and London. The commission list. Let's go ahead and see How can we deal with this sort of list? Let's go ahead and try to add my toes, phonebook. We'll be having maybe, actually, let's make this a street to give it a name. World wants to remember every name and Fulham we'll be adding maybe. Okay, Jake, be dismember. This is in front. Remember, assume that this is a move I or yeah, number four. It's at a couple more. Let's make this just related. I'm just giving it even. It's not first. Really? Okay, that's changes. Names who shoulders. Okay, let's go ahead and take a look at this into the bugging mode before you go ahead and do anything. Please break point in here Now that start into the booking mood, Um, let's talk order. Let's go ahead and over over the we're looking here termed it As you can see them, we have. Charlie is at the top J on the second. That's different than the the sort that we have you, because it's sort of list. And it's sorting the items inside based on the key here. So let's go ahead and tell him to execute this line. Let's go back. Um, making here to watch a movie. Quick, Watch quick wits. Now we can access. Here it is. So I inter first, Jack. Yeah, we have travelers. Jack, Woody, Jack on the second. So this is sorting it critically. As you can see here, this is the order that they entered. Good to know how it's stored organized inside of the sea shirts. Now, let's go ahead and try to display this. Do you think you for before each loop that you be formal C w well, for the item door? Maybe. Actually, that's meaningless. It was. Only numbers may be only the to, uh, bite him. Don't key. Or just a simple message in here to feel it. That and over whatever is just a message to make it more meaningful. Think with Charlie's, the mobile number is Dragon Number is just a clinic here. Okay? We can also access this using an optics. We have seen this actually plenty of time. So go ahead and access the phone book off. I would like to change giant else it to a different 12345 So I changed it. The so number off. Jack and I could go ahead and splayed now, too, baby. From number? Yeah, try again. It is now different. Jack was here. 8234 What a strange tumors. Okay, now we can also use the message. Try to get value 15 years old before go ahead and get one. Try to get value. It is. Go ahead. It needs a key. Now, I would be asking if Jack exists the number of Jack I can use a variable here. We need the key word out to let it out and string the okay. So this message would will do that. If the key here Jack exists in this list or the sorted list, it will assign the value. Yeah, get here to this number waking. Go ahead and play the number. So we have jackets, incomes, lives till now. We should have Jack. But if I give, it's a name that doesn't exist. Maybe James. Now it's no. Okay, there is new James and oldest. If I change it, for example or acted, maybe James in here dreams. It would be very special number. Now, here is the number of troops with dreams ready on the list. Does anything come here and remove from this? I can't use the remove here. And a sign. Icky like of maybe Willie out of the list, Willie. Or what we have again for each Lubin here. And you see, one should explain muscle off course, moving that still today. Look, Rick, you need to use this, okay? Now we extra currencies, this river, that Mac, he fixed it. Okay, maybe we display a line here. Yes. Well, naturally. Let's go here now. Display the item that being traded off the were removed from the list. Let's go ahead. And he's a list he reduced. Actually, using that, I did not remind whether the value or the key to be displayed. So it displayed the whole, um, list that they have. Actually, it was without It's from again. There is new will he? Actually, there is no Willy inside of this list. Okay, Come in here. And someone key, for example, displayed only the king. I have only the moving. We have shoulders. Jack. James, Jennifer. And there is no, But we will. Let's go ahead on and try to move my index so we will be removing after real. Really like to remove goals. Who? Whatever inside off the index. Well, now Index one would be removed. And now we don't have Jack. Jack was expanded. 01 member C sharp counts forms here. We have only three left. Colonel James. And we can, of course, come again and use the clear message Old collections have this message here. Clears the election for us or the sorted list or the dictionary for us Now it would be fine . Come here and try to display the count fun book that count from this. And now we And if we run, it has to be execute the statement. So no, it's running before it. And now you It's real years. The streets if we have And after we executed the clear message now we don't lift. That's actually lamented. Let's try this one last message, which is contains, I can go ahead and ask if this list at the same as most of the elections. If this collection has a specific que So go ahead and choose phone book, the contains and ask for the key or the revenue would be asking for the game. Do you have the key? James. If games is available in this list, they give me true, if not force when we have list. Yes, it's true. Let's ask about Willie. Really? What? He actually was removed So it will give Bulls. I can even come in here and ask about the value itself. Well, let's take, for example, this one where so we have this number? M Actually, if this number is available on this list and yes, it I changed this number number that's not available from the least. I think this member now bulls. Okay, I know that this is somehow operative. We have done this with the different collections, but it's good to mention the sort of list. It's one of the most important generic collections available in seizure, so I hope this was easy to UNC next. Lectures 13. Generic SortedDictionary: we have seen before that we can use a generic collection cold sort of list that we have seen also, that there is a generic collection called Dictionary. In this lecture, we will introduce a hybrid, but we him parts of them, which is the sort of dictionary. But what does this sort of dictionary generic collection gave me, I have read, is a sort of list and its source C items for me with the elements inside of the array. So why would I need this sort of dictionary? Let's go ahead and see some of the differences between the sort of list and the source of dictionary sort of list uses list memory than the sort of dictionary. When you're dealing with a large amount of data, this point will be Seydel for year, which will take less memory. Your website or your application to the live for sort of dictionary, on the other hand, has a faster insertion and removal operations for the unsorted data. So if you're going to do a lot off insertion and rule abrasions, gonna need to use the sort of dictionary, for example, one of the main differences if the list is populated all at once from the sorted data source sort of lists faster than the sort of dictionary. So if you are interested to discover more about the differences between the sort of dictionary in the sorted list and even the other collections generic and none generic, you can go ahead to this. Your elder Here I will give it to you in the final. Your elves. Here it is Yours. You are Elders is your face. She'll actually website Microsoft Way. You can find old the light breeze name, spaces, classes and now we have the sort of dictionary here You can go ahead and read all the details. You can find all the properties, all the mess odes, everything about this class. And he's actually some of the descriptions that I some rest for you from here sort of dictionary, generic glasses, a vital research. And of course, you can go ahead and dive deep into this. And here's these three points that I summarize for you that the sort of list uses less memory, and that's okay, enough with the introduction, let's go ahead and see this sort of dictionary help works. It's actually very similar to the other generic collections that we have been discussing. Let's go ahead, then create sort of engineering. Here it is the 1st 1 actually, this one, this is the name off the up, But I have your hand. That's three. How accurate it may be. Some one will choose. Invite, miss take. So this is the class here, the project here, the name space here see, to be accurate, sorted. I can change it, of course, but it's a cake. Let's go ahead and true sort of dictionary because I have any time to key with my pendant and the value would be time streaming. Maybe I will choose e colors of Make a list of colors that we've created first sort of dictionary. Let's go ahead and that, according to this, actually you will find all the message that we have discussed how many times they have been removed. As we will see an event in here, I think the first color is added, not in order. So I'll at this four. This would be please a couple. This would be to one lives and street, so the sorted, but the sort of dictionary will sort it for us. choose yellow, for example. Go ahead and choose Inc over you like, maybe blank on what? Okay, please e break wind in here so that we can see here. Buckingham, I started looking good. Now let's take a look at Peak Lear's quick, which is we have only for the list from Still did not executed. So, as you can see now, the orange in the morning because the key here is one that we have the yellow, blue and black. So it's sorted it for us. If I had it in our executed this right now, we will have the three in the middle here, as you can see, So it's doing the same thing as the sort of list. Just if you were interested in the differences, we can see we can concert or add a large amount of data and sort of dictionary would be faster. Go ahead and it read this little bit dictionary bold colors. Go ahead. Will you again use? I turned off maybe value on this And here is of course, I can't act sit again or change the value in a case like we're heading colors color. Maybe to change it for Mueller to Sambolin. Purple This you know, it's go ahead, end feet again. Reach from this it is. And then we have orange, yellow, white, black, blue and black. Now we have orange. Purple What? Little black. So be yellow waas placed by the We'll go ahead and use of force. The colors move happened, moves whatever and x women, for example. Again, read it The second column. Do you? Right here I was. Good thing. Okay, that's what again. Now we have the list without the okay from of so basically older message that we have discussed many times, like the clear finding that can clear the the list or the sort of dictionary for you, for example, contains keys value that's there also. So that's it about the sort of dictionary I hold. Just helpful. I know we've discussed a lot about the collection, but trust me, the every useful and you'll be using so to you in the next lectures 14. Generic Stack: In this lecture, we will be discussing one more collection that is available on the generic and under it is these tax. You remember we discussed the stakes in the nun's Merrick, and we discussed how stacks work just to refresh the information. Stakes represents the last in first out constant, which means that the last item that added to the stag will be the 1st 1 to get out, like the steak boxes, a tree or the coins, though the books here this off the top. It's the last one added. It would be the 1st 1 to be out. Okay, now, let's go ahead and see. How can we do this in seizure, I'll go ahead and time stack. And here, as you can see here, the January collection, Who's the Central T? Represents the variable sized last in first out collection off instances. Now I'm asking to remind the tired 30 years specified the time of the element. Choose our coldest Ram. Now we've created Let's go ahead and try to add items to distract. Maybe there is no at, of course, here. We need to use the push I need to string interesting example. Process leg visual studio. Well, this is the first. So that will be held in the Let's go ahead and one more. I can't had a couple more. Maybe the we'll go room, um, the that we have these tax gold grab with some off hazy processes available on the left Over here, we can go ahead, actually, and display this using for each coming here and choosing collections around. I think it's believe this. Play what's inside of this thank you. Go ahead. On three days, we have the visual listed, you know, but the ship individualistic view why it has. Actually you didn't have the visual speed times, So I think that's visual studio. Let's go ahead to be sure at rebuild execution from this owned Now that's right. We have the note Bad Google cruel for to shelve a realistic. So would you introduce? Added, Ah, first. Now it's on the top, and the bad has handed littered less so it's took. You can make sure forgive the him for what's actually on the tub off the state, using a message Cold ground me. Here it is. Return is the object at the top of the stack without removing it, so it will just help me. You don't. So what's stop is the like in stop off for this love here. Here it is. It's a number. If I have it some more. Process the so And we have the exact actually Chris. But the name, of course, So 15. Generic Queue: In this lecture, we will be discussing one last collections available answer. Genetic hands and on generic collections, which is the queues. And we discussed it before when we were discussing an engineer accused just to refresh information about cues. It represents the first in first out collection of objects, which means that the first element to be added would be the first element to get out like this cute in here. The first person came, would be the first mom took it served. Let's go ahead and see How can we do this and T shirt So we'll be creating like you. Here it is. She's a description presents the first Evan first out collection objects. Now let's remind the let's do something different. We've choosing, for example, the end before and the string that choose e type off date. Okay, so this would be a queue of daytime's I called it are right holds and then we have what you okay. Having items is askew here using the ink you message. There is no Adam here received, thank you. It adds an object with the end of the queue to go ahead, and he did as you can see, Now it's telling me that I should at a date, tart imposes list or a queue of the day times. So let's do this. But she flies. And you, the time in here. Give it this following dates. You know what? 1st 1 is that a couple more? Maybe this is. And have you bulls actually in the monsoon? Should be seven. Could be temporary. Normal of this would be seven. Maybe this is so. They're not in the seam order in here and they are not sorted the assorted based upon the having time off them. Okay, I think this too. See this seven? Okay, go ahead. Them use for each loop to lay the items inside of this. You rivals just see, Don't you actually fears I took? See? It is sorted based on time. They based on having times will be and two seconds Tarantino's for historicism 16 from 2018 . There is also this message here that we can use You know, you at the top of spring. The message, the message It's cold. The seen it before with this type is use peak to kill what is on the top. We can have Yes. Rated boil idols in here from this. So at the top there is this about you here. Let's go ahead and try. Let's make a space here. Let's go ahead now and try to move on this list. I will be using the rivals dot de que There is no room over here. There is a cure which removes and return is the object at the beginning off. Thank you. Go ahead and use under the objects again. I think this is a copy. This will again display the peak and just be items without the The 1st 1 that Waas removed is at the first we have at the top 2017 and pugilists. Now we have themselves on 16 because two and the first item most removed If I want to run this again Ugo, we moved to items so the 1st 1 this year would be removed and this would remove that You only have this one. I was 18 It is top 2018 and only 2000. So that's very basic about the queues. The are very similar to the stacks Only the the stacks represents first and the last in first out and the cuse first in first out my hopes Easy to you ends in books, lectures 16. KeyValuePair: and this lecture would be introducing some new collection to you. It's not even a class. It's a structure. It's called key value. Key value pair actually stores to values together. It's like a dictionary, but its destruction. We can use this key value pair to give the list. The genetically is the ability to store two pieces of information. If you remember that, the list can only store one pair of information but using the key value pair with a list, we can give it the ability whose toe pieces informations. Let's go ahead and try to do this. So I'd be committing yeah, list here. Article it of using keyword bar, call the capitals and use the generic listing here. This is so normal. Until now here inside of this records in here I will into this we value. Here it is it the structure defined a key value pair that can be set free by virtue of this when Ebola tube that the key off this key value pair would be of time, string on the value would be if time string, I can, of course, go ahead and choose any time I like and double any time would work for Okay, so now we have this weird list here. Let's go ahead and try to add items. So choose Capital admitted it is Now it's telling me that it needs to take the value period of string and string. So I will do this. You you hear it is I will enter, for example, Russia again for the World Cup Most co No, a couple more. Maybe choose. We didn't. Sweet in the chemical sweeteners. Still cold, Maybe what a go and one last record Japan on the capital is. But I think that's information. So now we've created the we had list here, which is named Capital, and we have a sign for records to it. Okay, let's look alike this list into the bargain vote, so I will place a break point in here and try to run this into the bugging mood from this to execute these lines. Now let's take a look. And capitals Here it is, as you can see now, this is a list, actually, but it has two pairs of information thanks to the key value pair here. This structure we can see in a dictionary or a hash table, but not in a list. But now, thanks to this key value pair we can work was a list as Schmidt. Those we have here G and value um stores. Two pieces of information was out. Any I can, of course, coming in here. And there was some basic manipulation to this list. Like revealed. I can remove, for example, the I to one Sweden's where speeding would remove you. Go ahead, rated fully, have it goes cover told CW this play the item value for Gumbel and curtails the list would be without speeding because we removed. Okay, Sweden, Stockholm can use key. Just you did special report ago in Japan. I stopped this. Of course we will have We didn't. It is, sweetie. Okay. Actually, the key value pair is somehow a little bit complicated, but it's very helpful. We can also use it in another scenario, not about the collection off the lists. OK, ask you. This scenario is me that I would like to retrieve the first name and last name someone so I would go ahead and create yeah, message here only that they I would get where is name on blah, blah, blah I continue till I returned the name. Okay. And then I will create another message to return the second name of last name. So what if I want to give the first name and the last name to be returned from a message in one fable? I could use this. I could use the key value pair. Of course, I can use an array we can use also a key value pair. Let's go ahead and try to do this public string for no first and last night. Okay. And I will define the string first. Thank you. My name. String Last name. Same. And now how can I return this man? How can I return the first name and last name? But work doesn't doesn't even work like this. So it's not working. So to fix this course, we can use a list or in Arabia begin. Here's this key value barrier. So I will change this time. You make it key value pair streamed and ST King and it accepted it without any problems. So this is E message off time. Key value period off a string. This string. Okay, Weird a name for a time. Okay, but this is actually told to leave L A. So I can come in here and after I assigned the names or get it from a database or file or from anywhere, and returned to the cooling function, do you think? Yes. Here. Good. You the value pair string and string and first name Andi. Best thing. Yes, sir. Now, with this one line, we have return to the calling from some that we will call here where they call it the his name and last name. Let's see. Can actually display the results. And c definitely this. Okay, so whatever is returned from this message in here I can and displayed in this breath line. So go ahead and run this and who it is we have my first and last name will change it. For example. Tony story. Let's run this. And here it is, Tony Stark and I can't even to choose from this missile what I would like to display. I would like to display, for example, the key. Remember, the key in the first name, it is totally and on camera truth value. So I used the key and value concept off here. It is a story off the key value pair to override its sittings, to take the first name and the last name and any actually periods of information that I would like to pass. Mrs. Okay, that's it. I hope it was fun. I know it's a little bit complicated, but it's very powerful and very good practice to you in the next lecture. 17. NameValueCollection: In this lecture, I would introduce use on interesting collection called name Value collection three. Basic from its name. It uses name and value to deal with elements. Let's go ahead and try to apply the sensation insurance. We need to include the name space that this class is inside of it. It's different than the others. So still, the collections specialized. Here it is. Then we can go ahead and start using it. Name, value collection that's read the description. It's the Let Me Represents a collection of associative, the string kings and string values. Here it's forcing me to use string keys and string values on Lee. I cannot use that injures or doubles or eight time any other time. Only strings go ahead and treat the distance. We have created it successfully. Let's go ahead and try to have elements to this, so I would be using administered. The first overloaded one takes name value collection. That's not what I want. I want the one with the string name and string value, so go ahead and this may be Germany. One value would be Lynn and one of the featured off this collection actually allow you to use the same name here, or the key without any problems. So I can have Germany multiple times without change this. You worried this. Thanks for maybe this too to wait. This people you again. I mean, look, let's take a look at the working to see how this is a structure. So let's go ahead and start in the working world. The last line. Now let's take a look at the structure. But actually, we have here five figures. Let's go and take a look at the city's. The count's to only do that. I can see it was It's counting only the names here, and we have only actually tuning Germany and Italy. So how can I access this city is a year of this values here. Let's go ahead and try to do this living before itch. Oh, make it Forest King. Leave the details around The collection is cities the title. Now this will display for me, Germany and Italy. The names. What if I wanted to accident the value itself so I can do this? I can't like France's city and a lake, too. Clinton. Which city it is that we have the lead in Hamburg and Frankfurt, Rome and Millet. I can even have the city of which one of them year. So I come to Brighton on the symbol colon in here. Now we have Germany. We have this recent is and Italy. We have this city's. There is one message that we can use with these. It is it's called cept weekend said the value, for example, off one, an unnamed. Here are key I can use. It's really for example. Oh, I would like to replace it. Was this okay? So this actually Will Ripley's The Most records federally but only one. So it's not role. It's not me that it's pose of them. It will be only one. So if we try to run this now, it is a first. It was Italy was Roman Mylan. Now it's Italy was only Venice because we have two records with this name. So it Ripley's did totally. So you have to be careful when you're using this set here. If you have duplicated name or it has also a message calls has that the chicks. If there is some kind of value inside of this election, so the cities as that's keys in here so I can ask if it has keys or not. Yes, it's killing me that it has. If it's empty, If I cleared it, it is. But here they run this now fools. It will not have any keys or values, OK? And of course, they give him first. Tremendous From this I can, of course, coming here and remove use again using name all I removed for example Germany. This won't believe. Move. Hold the records that has the name Germany. In this case we have three and we have only one equally was Venice. So we will have on Lee Italy. Venice. Okay, goes Roland Mylan were replaced by violence, and Germany were removed using this. But if I removed, for example Italy, then we'll have only Germany here. This Germany and the streets. It is over. Okay, remove all. We have seen it with the clear. So I things. That's it about the name value collection. It's helpful to and that's it. See you in the next picture. 18. List of Animals Exercise: out storm for an exercise in this exercise, I don't like you to go ahead and do the following. Read the glass cold. Any moves and inside of this class create the variable called blame stops string. And of course, it would be private and greet the property to allow access to this private they're able name also the animals glass should contain to message. Say hi and see. And now go ahead. After you finished. Greetings anyone's glass and creates three innocents off this animal glass. And now go ahead and create a generic list. And this re distances that you just created. Two Legionaries this and try to look through the list with the different animals and called to see Okay, most of video. Go ahead and try to do it, you know? Okay. Welcome back. I hope it was easy. Let's go ahead and try to do together. So let's take a look at the file. Here. You will try this soil included in their products. Now the 1st 1 create the glass cold. Any mold, sir, To do this with the class, Anyone's What was that? The next on the list is the variable name and property with the seeming to go ahead and use the amazing stuff it full that applies change the type of the variable string the name, name and the property name would be named with the capital. Now it could be the message. Say hi and feed to easy bubbly. Avoid me. My the devil is never kept twice. Just they must collude My my name is the name. Yes, it cool you c w to place name they just use him. But concatenation, of course, is now eating Just thievery. Hazing messages to be displayed Next we're done creating the class. Now let's go ahead and create three instance off this class. So here it is. Anyone's dog created the 1st 1 We have a dog named Call him Max. Again. Any moves? Give the cat name Lucy. Lucky Busy. Any moves? It is something in other funds. Give the elephant name. I don't know. What should we call it? Anything. But I have this funny name. Maybe it's a small Okay, Jake List. Read the list A generic list and they had the street animals too reckless. So let's go ahead. And I'm assuming that you have the collections the generic name space included here. So Well, sir, accusing this. So here it is. This here inside the type of the list, I will choose animals. Okay, so I am creating a list off and wolves call it list. Well, you and created Egion act list off. Plus that we just defied. Now let's go ahead and we have full access toe hold. The message's off the eric list like the removed contains any missiles that we have seen before. We can course access be using the AB. We'll be adding animals here. As you can see, it takes animal having the dog, then the cat, then the elephants. I know that the effort will they a lot of space and in the memory, of course, but hand the real life. Okay, let's check what's on the list. If we run this now, let's go ahead and chicken banging mode. Excuse this again. Now the list actually have street elements off type animal that you can see you 1st 1 max the dog on the next is Lucy. You love the cat. And of course it. Now let's loop through the list with a different animals and called the sea. My message. Go ahead and try this. So it will be using the four each. It is taken. Access the universe. Mother collection is called least well. Now CW. Let me Don't do this again. Use the I tell you, Don't you say hi. There is no saint names. It's run those. And it is Rex Lucy. And if I change it any name, this may be the story. This is and it is. It's changing any public. So now we successfully finish this exercise. I hope it was fun and easy to you in the next lectures. 19. Generic Classes: in this picture will be discussing something very interesting. We have seen previously that we can use the genetic collections like the lists. The dictionary is the search of leads and many others, but can create my own custom generic less. The answer is yes. Course you can create a generic plaza takes any time. Sounds interesting. Let's go ahead and see. How can we do this? A teacher. You have some information for you. I'll be creating a classical buildings. It's about some of the towers around the world, the famous Empire State and some of the information here. The height of the Empire State Andy height with the tip and the weight off it. And where is looking to the city where the building is? And I have borders, Khalifa. I think this is the tallest building in the world, and here the A hide off the building and here, the height of the top and the weight again and the city it's located in to Buy and Evil Tower behind the height of the Web. Do wait and, of course, extricated empires. So let's go ahead and try to create this generic glass and drink. Glass will be accepting this numbers in any digitize, maybe double dissimilar, flowed and any number it will be accepted. Be creating your class home buildings him to define this as a generic glass. We used this records here and the TV in the mail. Now we have told Compiler the C sharp that this is a genetic class. Let's go ahead, interview some variables and properties. Use the never purple pull in step twice. There it is, Well ahead on defying the name I have name again the property name. Now let's go ahead and defined the L Z City, maybe Dream String City that was created. Two variables string the name and string city and two properties that access this. Now let's go ahead and try to define visionary variable that we will be using with this number of the hype and the I would be using only one of these, not the blossoms. Okay, so let's go ahead with the problems. Minute stepwise. The type to remind the tablet which Knake We use the deep again on hearing the name by to go ahead, change the name property to hide. As you can see here, the type of the variable t and the time off the property. Tea Also again. Oh, Lawrence Team, This would be we weight of the building. This would be but what you called Wait. Here it is. Now we've defined a genetic glass which takes to genetic variables properties here, the height and weight. Let's go ahead and see How can we use this? So I would start here having the party finding for his building. Here it is. It's building stuff generic and inside of here. I can define any number or any desire, actually that except the number. So I will firstly greeting it end well. This reporter states, Will you wave the Empire State which takes in? No, that's good. Have deputies or the variables to this instance The name would be first. This is the name that will be displayed. And this is the name of the instance. Don't get confused. I will be using Look your best for this. The city it's located in you. Your on the high can use of the reputation, of course, can use either. I will use the one of those that Okay, maybe that to make it look taller. Now the weights you have to wait very few the actual week. Now we've convey ated an instance Oh, glass buildings and it takes an M As you get a time. Let's try to define something else Building. Now I make it to take a double. Made this these It's a double on its give it some mention the name you saw the city it's located And Dubai And again the high That's the the oldest building on nurse before on lost information The weight. This is real information, by the way. Okay, let's add the evil tower. The building. Make it Tom, Maybe float. Go tell our a little tar name. Begin ital Defining the name Love the instance. Name you don't Our city The famous city there is evil tore again. The height Actually, you re beautiful. Building 300 for to find of the way. Oh, the tower, the so themselves. And that's it. Let's actually now, try to Luke or display this information. Okay, two are the using CW to display this so well. We don't name this name on excess border state name. Same. Here it is. Think this Copy and paste change this Election city flight. We changes Properties City. Right. Wait. Let's run this. Now we will be displaying only the Empire State Information for now. Here it is, the chicken. Everything's working foreign and as you can see name and part of states it in New York. And here is the height and weight. Let's try this with what is C W again name and used distance Name? Yeah, on the city city. All right, Chemical. It's and change the property to hide and change the property. Maybe just that'll take you lining here. Yes, I want you. Did you learn? Tu Brute seems on the trunk and it is. Then we have the part of state information. And the fortunately the information was different Data types, as you can see with the double and the 1st 8 woes this time, as you can see. So this is how you can create generic class? Actually very helpful. And I think you will be using it in your applications. That said to you in the next lectures 20. Generic Exercise Part 1: Welcome back. Now it's time for exercise about genetics in this excess. Alright, I'd like you to go ahead and do the full of through the glass cold movies. This glass should contain a movie name directed great and released the It's also time generic off course the rate and leaves the would be of time generic. So we can you the rate as a double or a salute and release date. We can use it as a date time on em, and then case is an event I would be using only the year. Now. Go ahead and create instance off any movie with many volumes like Birds Rings or The Dark Knight or any movie that you like. But just with many voters, no start adding the information about its movie. Now go ahead and greet two lists and have different movies volumes to each list. For example, Lords rings, and so we shall have to lists for and each of this movies. Okay, well, the video angle ahead and started to this. You are okay. I have It was easy. Let's go ahead and try to Do you have a slide of the requirements I didn't want to use a specific requirement. I want you to sink about it for a while, Okay? So let's go ahead. And practically 80 glass movies. It's a genetic glass was aggrieved, So it's class movies on its Agenor. Okay, so the next thing is to movie name director rate and released it on. Maybe if you noticed here I have the information about the movies that I would be using. So I have The Lord of the Rings. The Fellowship of the Ring, The Two Towers, The Return of the King That mom begins a dark night, The Dark Knight Greatest. And here I have the release day, the rate and the directors. Okay, And I got this information from I Am Beat Every famous website. You can get old information of any movie here. The names of these date of the year, the rate according to IMDb, of course, and time the director and all of the information, so you can use it to get any movie that you would like to get all the information. OK, so now let's go to the next one contains within it that we should go ahead and create for Ebel's at properties uses limit Put full first blonde movie name, Live stream. Of course. Here it is, actually No, no, no, it's created the variable and poverty again you have are creating the next is the director maybe string directed blaming the director of the capital T. This is a property. Now let's go ahead and create the great hands you released. It is again full waas. This would be t as we have seen before because this is legendary where that is the But at least they the name release the okay, all these late with chemical or this is a perfectly name again for full. Where is again T? This would be great. We're able now. The rate Okay, don't know. I've defined my class. Let's go ahead. What's next now use The rate is low. Now let's go to the program and try to create an instances off this movies. I think your people Lord of the Rings first and his information that I would need movies use, for example, the double um maybe cool it, Lord, do you I mean, just using a burner that's not the best convention, but just uses for someplace. Okay, Don't ever start adding right included ring stuck movie name on a movie name. We have an choose old movie name. Here it is, Lord of the Rings. This is the first port You watched it. It's the fellowship of the ring. Learn drinks again. De even connected today through the movie is Peter Jackson. You know, I'm just having the information, and they prepared it before I started this. A lecture. Here it is now that would of the rate. Now the rate would be of title. If you feed this your it's all style double because this is major class of stubble. But we will have a problem in a second, so I will give it. For example, one day it's my grades. That's the IMDb. Now let's have the released. They would be a problem. I'd like to give this here at the daytime, but it's only allowing me to add it as a double. And this is actually a problem because this blast I defined it as a generic end. It's a time double. So how can I be sworn this rate as a level and their release date as a date? This is the first problem. You may be thinking so we can go ahead and actually report full that this would be a direct off heat and maybe actually the letter you. So no, I told it that there would be two genetic types here and first world de, which is the rate. And the next one would be the release date. And I represent That will be later. Your No. Let me go to the definition here. It's giving me an error because it means a mother time. And here it is. There is e t and you. Then we can go ahead and be picked up. Okay? It is again the time. Okay. No, go ahead. And now use he release Date one. Let me take a look at here. It is off time. Daytime can't fix this. I would give it this year. It's a new day time, and here is the date. It is the year First months on End the thing. Well, let's take this that the company in create a couple more, changing the names and details. Who is for two three? Let's go ahead. And names and data for each systems of the movies. This is the next movie on board with taking volume. Verdict With the changes erupt only a very small room now the date would be change the also in soon. Don't forget that Changes in distance names. I think this is one of the tricky that we can Fulin when we are a company in Princeton. Changing now. Janie again The movie. The last part of the seriousness woes, The Return of the King King Richard They were now to see my direct put, and it will point fine. And if this 2000 three December So okay, now we've created the three instance off movies. So now I think it's time to had I have the information, and now it's time to greet the list and have different movies to the list. So I'll be convening that. We have defined three separate instances right now. I need to add this instance to a generic list would be created at list. They focus with me here, so the list actually would be of Time movies and with the taking a double and a date and Erica look, maybe first and it is created first. Now that's actually had the list here, so go ahead on his first list had having Lord of the Rings one the same. Colin and Teoh. It's actually sees this into the booking of the year. When in the mugging mood, of course. You this I've liked. Take a look at the first list. It has the archers on. Here he is the information off each. I used the return of the king and you have the two towers and raid and reasoning for each one. Okay, Something just mixing simpler. We can replace all of this with the war before first list and still works the same way again. It is. It's excuse this and working the same. Okay, before actually is very powerful and and safest of left off. Good. Okay, I stop the video here and I will continue solving this exercise ends at next video to you. 21. Generic Exercise Part 2: now let's continue from where we left off. Now let's go ahead and try to create the next glass off glass movies with the different yeah, data types in here. I would be using a slowed and M and thereby creating and you list toe have the next set of movies. So let's go ahead. And to do this we'll be computing the movies. It's time. Look, first, this would be the rate on the end. This will be their release years. A little coldest, maybe. Morning. All right, well, well, new bridges. And also I can you divorce keyword on. Also in here we can save neither. Trouble is if we run this yes, to make sure that things are still the same and go ahead distribution and well into the bugging mood. One. It is the first list Rizzi toe item of the last one still skewed on this, I take a look and the is that they have here or the movie class. It's so let's go ahead and story information about the you bless you. You're the right one movie name. Your name begins on the next he's information and the director on your next geology of tonight is Christopher Nolan in? Well, let's go ahead and fill it. Read. It's off type, as you can see here. Now the reed is off time float. Remember from the previous picture or the solution. The red here with five double you can see. Now we're using. No, I'll be giving rate. Let me. This is candy. I am TV 8.3, and if I leave it like this, give me Arabic. Oh, this would be a double that we need to tell it. It's a fluke, right? No, at least eight. And again, Release date is off time, and now that date times will leave only the year. I don't no, I have create me makes oh like to again. This is love the paste naming convention. But this just for a clarity and simplicity. The next movie with Beat during Night on It's actually a good movie. I love it again. The same actor. Sometimes he directors change when you're doing sequel or be equal to the movie on the raids. The High Street Well, no, on the hey, let's go ahead and the last one would be the dirt. My greatest, which have the villain being. Actually, I think it's also one of the good movies, you know, Try this. It was 814 and he's on the way down again. Don't forget to change instances, because if I use this now, all of this information would be sort Onley in the Dark Knight, for instance. Three Tree Tree. It's actually commute than you list now. They called it second list, and with the flu or okay, let's go ahead. And as the different iTunes here in the list, Oh place, years taken list. Derek nine, Port one, two and three. And I would like to go ahead and check the debugging mood again to see Housing's organized . Let's on this. Now we have the first list. As you can see, that's using what year it is here, the items inside of it. It's class that takes the will in the time and with the information, the different information about each movie it is. Now let's check. The second list is it's the movie that takes floating and and here is the rumba, gams and year. Actually, the information is implicated because this is a property and this is even able armed are saying Sets nice. So that's it about the exercise. I hope it was easy. I know it's a little bit placated and lots of information, but actually is very powerful, as you have seen to use the generic concepts or classes inside off Teacher. So, uh, that's it for now and to you in the next picture. 22. Tuples: troubles. So what is it you will you will actually easy data structures that has a specific number in sequence of elements. So this simply means it is a record. Take a look at this example and we can say that, John, this is one of the elements inside of Cuba. All have this income at this year. This is another element inside of the tube. Ooh, on this income at this year and this income and this year, so I can keep heading elements. So the income for John. But can I keep heading for a limited amount of sport elements inside of the tables? The answers he don't let free more directly supports troubles was warm to seven elements. But wait a minute is only seven? No, the eights element actually can be a pupil itself. So I can haven't you will inside off vegetable. It's a Mr Two bills which gave me and unlimited to build that they can keep adding I know this sounds complicated, but we will see how can we do this seizure? But first, let's go ahead and try to compete repays. Thank you. I'll be creating a record or trouble or information about and a gleam toe reader. Vrabel cold well into can't read that you will probably five new Jubal. And here, as you can see, I can keep adding elements. So 234567 and the eighth looks difference. Here it is. It's the nested Jubal. And we will be discussing about this story. That's could be. And this would represent the free number and the stream. The first name of the plea and maybe another string. The last name of the plea. Maybe a date. Tom, The hard eight for them plea is this is just a structure and maybe a pool to tell if the employee is in service order, but that's not it. Now we need to give the values. It was a terrible you choose now would be using maybe be the number of me 100. And his first name would be Jack early second for the last name. Maybe William in the date time would be the higher actually many this year. Maybe he's a fresh 15 on. Yes, he is a service. So I choose you. And now we're done. We've created the trouble. Let's actually think a look into the bugging Mo to see how it is a structure that's room There's now under the bugging mood and collected Here is here is the variable hopefully information. If I opened this sign here, Here is the item one is 100 to Jack and the doctor here will be data's. They gave it to him in the order of 1 to 5 families. I handed more. It will keep heading. Okay, now let's see. How can we explain this on the screen? So go ahead and see w maybe display. But the for mentioned on Timlin born Take this copy. I kind of course used any take Is that the employee number is But I will just display the Blaine information Here. This run this now Here it is. Here is the information about this me And of course I can it can't this to a daytime and remove the time from you so I can go ahead and you're and Philip that this would be off they turn It is You remember how to cooperate it, Dude, from these life I don't know access to the message of the date time, you know, like in Jews don't short dreaming. Run this. It is with those talks I like and only displayed the year any word of the find that I would like Now there is another way, actually degree that you will end. It's even easier. Maybe a student. Information. Go ahead and use the Tupelo Q V eight missing here in this gates E one tuba land, like in also has many other want. And the leverage seven indicates that they told you different and we will discuss it so I can go ahead until it you didn't number. Maybe it's five on the name of the student ISS John and his last name is even strange name and his first date Maybe I don't know themselves. Young is still at school, maybe. And 10 and I can keep having that. They don't know. I have competed De Cuba and I again I can he w and Texas information about the student. Here it is, I think one change the candidates. Which one cream for the room? This And here it is. Five. John Kevin did it to That's it about people. This is how we can create every paisa que next we will see. How can we place a cue ball insulin for trouble to you 23. Nested Tuples: Now, let's see. How can we can get mystic? Jules, how can we create a terrible inside? Assume that we have this scenario here that I would like to all of this information inside of Cuba. Simply number first name, last name, address, city job title, nationality and the last five salaries on this impolite me start here creating the people will give it a name. Maybe MPRI information is curable and the first but the end string being a string, they were reaching the end. Now we reaching the end here number eight, which is the dearest Here, here. I need to convey the new treatable one side of this table. And it would be taking this alone that's alot desolate. There's more and one last. Okay, let's go ahead and try to have the data to this. You go first, but maybe number 100 I've him the name. Maybe James. As you can see, if I'm adding here, it's highlighted to the year she now we are at item three. I came to I'm going back one you can see. So as you're moving, it's telling you where exactly are you so that you don't get confused. And James? Maybe What? Some, Um another actually Leave it empty until we reach to be people that like to feel. Now this is seven. And here the table itself. So I will be creating cable. Look, create. Now let's add the data. May be the first celery would be to 1000 three thousands, four shells ums laughs. Now those and five thousands again, that's enough, actually is giving me in there. Can anyone figure put a scare? Yes, this is his time end now. But I did not tell it that this is a decimal. So I need to get in here and feel it. This alone more dismal. And the air is done. Now, let's take this into the bugging. Moved to see how this is the structure inside a T shirt. I'll place a break point in here. Run! Let's check the MP information. Very well it is. I was telling me that as all of this information and the last one actually has at home five different if I'm using here, go ahead and open it. Here it is. She is very powerful, actually, but I'm gonna access it inside of the sea shirt itself. so I'm gonna go ahead until it Let's use a CW. Well, the information, like an access here, is the item that they can access them. And maybe this a good in here. The name is what name? That's something different name and a plus Sign concatenation and then I can have the last salaries and you're it is like and go ahead and kill them. Be information dot on and they're like taxes. The risk property here in ferment I have access to the five. This is that value that they have it so it connects is the 1st 1 and that makes him the next Just go ahead and change the items. This is for three of this is five. Let's run this. And I think this is also near the complete name of games in the last 57 It would be here if I change it. Any of them. Of course it will. A change. Lyrically, here it iss the eight sounds to That's it about the nested tables to you in the next lectures 24. Tuples With Methods: Now let's see. How can use dribbles was Messing's. Don't go ahead and create your message here. We'll make it. But first I think let's play for mention and this message would be only displaying of information, but it will seek a grounder off. Time to build to this people would be and string string against drink with maybe a person. That's it. So the message would be displaying the very soon that Air Flight One on changes the iTunes 23 and four. Now, this miss it now needs a pupil off the same time that we can call it and passive than it will be displaying this information for us in the main message. Now be creating a YouTube alike bullet. Maybe this is variable. It's called Aria be creating. And you people here usually create. Never give three basic information. Maybe the and he would represent the edge to use this thing. Well, this is a director from game of Thrones. Again. The name is Aria and story Um, he is from so okay. No, I can go ahead and call the message, display information and pass the variable. Are you, which is a double friend? ISS make sure that everything is working correctly. And here it is. Now everything is displayed. Three. Grisly. Let's go ahead that communicate in another one. Here, sensor Chief of the director also, maybe she is 18 sounds You are making us and again display information with the variables. Some segments from this and he read the information about times. Okay, we can go ahead and create and you mess up. And actually, I will make something different to stop public study and void. If you remember, avoid means that this message will not be returning anything. They can make it string. I can make it a double dissimilar or any other time, but I will be using in your time here. It's the time of cable that takes and string string Villa string. I know this looks weird, but this is actually a time we can use this. Of course, you can go ahead and at daytime or any saying that you I would like to work with and I would call this mess of maybe and get information. Okay, Now this message needs to return the variable of this time you will of end and three strings to Let's go ahead and created inside of here called this info and you go look create. Maybe I'll use 25 will be using Rob host one of the tractor from the same job, Same family, and he is star cold. So we love starts and I have winter. So this is worried that you live. Okay, that would be returning the temple here, which is of this type So coming here and see that you just okay lining here Two different shades between are you a story can, So it's gonna have to w again information with the message. As you can see, the time of this missile is capable. That takes end Ansari strings and is what I can packs is the elements inside of this here? But they are already back to the cooling function you think adopt. So here with item one, I think to white and three item four. So you can go ahead and do this on change the index 23 and four. Now that's running in. And here it is. 20 far throb stork developed. Okay, that's it about the cube. ALS and message. I hope it's clear to you in the next lectures 25. Tuples Exercise: Now it's time for exercise about two bills and this speaks a science. I would like you to go ahead. Give me the list of tools and the people itself. Consistence off four elements. The free number, first name, last name and the hard eight. But I hadn't displayed the content off the list after, Of course, you feel this list with some random data futures. Go ahead and sort of list. And this pleaded content again, sorted in descending order and trying to display again. Relax and enjoy what you just did that thing where you will be doing this together. So what was the video and go ahead and try to do this. Okay. I hope this was easy. Let's go ahead and try to do together. Here is the list it'll be creating and inside of the sprockets in here. I'd be telling seizures that I would like to see the people inside of this list and this Jubal will be having four elements, etc. Event, which represents the every number in the string. The first name string for the last name and the date time for the hardy Google it in peas, inflammation. And we are done in created the list of fuels we can go ahead and at least all of this with of or that's easier. Now let's go ahead and try to data to this A list of troubles in here, So I will be having the 1st 1 How can I have dated a list if you we can use two options the first woman, your thing, this before New people. And here it is. Now it's open currencies in here and try to sell it with the data. So the 1st 1 maybe the number would be three. And the name would be Thank last name Peters, Peter over and the date time. Here's the time. Maybe he was hired recently. So 25. Okay, this a D for stricter. Or you can use a simpler way to add date that this list of funerals, which is terrible gate and it seems before as well, now we can medically add the data, so I'm giving them not sorted order. I'm just filling them with the random entreating here. So name maybe Adam on a little dream. You, the Torah, maybe older and maybe themselves from 15. This is his hard eight okay, we can go ahead on. And one more records. This would be emptied before John. No steam. I'm just giving any random death. Go ahead and choose any data. 24 of one. Last number two IHS. Emma. What, sir? Or maybe behind a this year? Okay, so I will be placing a pre pointing here just to take a look at the structure of this inside decision. So certainly the bugging mood. And now let's take a look at this variable here of these information or the list. As you can see, it has four items, and this is the 1st 1 as I type them. So Zack would be number one Adams number two German before, and Emma is the last. As you can see, your this is old. The items off the tables. If I over any of the sling site, open it. Okay. So how can he displayed this with seizure? Simply we will be using it for itch. Yeah, I find him. And the collection is gold in his information. And like we had w we have ecstasy item. This item here is this lighter, not the temple cables. I can go ahead and change it so that it is more clear. Maybe this is empty or on E. I don't. 1234 and dream one. Let me actually use string interpolation in here. It is easier. Have the This is Yes. Okay, now rated white comers. We'll be having the first name again. Cramer Or and the last name again. You already? Okay. No, that's this play this. And it is as you from C Zak, Peter, Adam Green, John's Mass and Emma. What's a What's a Give me it. What's, um what is another name? I guess. Okay, So this is how you can create the list of troubles and start adding items to sit using this to techniques to now I need to sort this list. As you can see here, this list is not sorted. Here's 3142 That's not a sorting. No one can use the certain off the list very easily. You can go ahead and that they be information. Don't sort Now. It's sort of like to go ahead them its weight again. Yes. Can just play messaging here before sporting me. For now, after the sorting Hamlets from this on and as you can see is a difference in years. It was everything. It was 31 for do. Now we have 1234 And this is actually really nice. You can make maybe just a tip line here. Remember, this escape sequence takes line in here six. And you learn. Now, let's go ahead and try to reverse this. Make it any similar. This is a copy. And then I will be changing the message that are using on the using invested cold reverse. Seen it before. Now off to be reversing. It's run again? Yes. Then we have the list sorted in descending order, as you can see. Okay, that's it about the exercise. I hope it was easy. And you enjoyed it to you in the next lectures. 26. Value Tuples: in this lecture will be discussing enhancement off two bills in C sharp seven and now they are cold value trouble. They are not included by the fold in your project. We need to go ahead and have them and start using them. So from this mean you tool in here, go ahead and choose. You get package manager ends and choose managed. You get packages. It's unusual from this window you will be able to choose any package. Would you like to add to products? So I'll be willing to search for when you're trouble. They have it installed or included in my project. And you will find it here in references near the U Value travel experience told. So go ahead and stole it. And another way to included in your project from the council. The package manager console. You're fired. It also. And the tools you get. Package manager, Package manager Here it is. Go ahead and have this command and stole baggage. I have it here system, but you need to know the name of the packets that you're installing. Let's go ahead and run this. Now it's dealing me that I have this package included in my project. So now let's go ahead and see how the value chewable works. All the differences between the normal trouble and the value trouble that were introduced in C sharp seven. So there is a declaration off a variable X. What's tight end? And here is he value? Ousland, This is very basic. We have seen many times. So in the value trouble I can come in here and feel that this is the type off the dribble. Maybe. And I will convey that you pull off a player, maybe the player number, player, name and the score of the there. Okay, the goals that he scored Don't be string or a little bit Uncle. This player, maybe no older. And then I will have the vendors itself. Here it is. Oh, maybe number seven. Whose number of there? Ah, the name. This would be the gold. Maybe 55. Now we have created successfully arguable. Well, well, Look, we can go ahead and accident like this. So what? I'll do years Item. One night in 2123 Copy and paste. Change the item. It's just Mt. Light. Let's run this. And here it is, as you can see. It's very easy, Teoh. Being with you build this. I can even come in here and names. And it is actually very so I couldn't say that this is the player number. And this is the player team on this clear schools. I can access him now by name or by the item so I can tie by 12 or three. And it was to work like this where you can even and this is very helpful. Choosy Name, clear number. Maybe the name here and the player golds. Amazing, huh? Swim this. Now I can come in here and use of or keyword. And you will understand that I have this Ubilla structured this way. Sure. So we was before Maybe Yes, maybe. No. And I will not live here. The type I would make it on leave or and in here I was given the numbers. Maybe 10 on the name is Messi and maybe 60 gold. Oh, now this is the same. So I could come in here and feel it, Missy, Though I won. We have one more This movie if I run this now, as you can see here it is works. The same divorce replaced all of this line in here. Very amazing. But this one doesn't have big names. How? How can I get names using the powerful before? So I can come in here again and maybe just one look meeting players in here I'll be creating this is actually in here. Clear number rated. Why Colon, You can give me the names, clear name and maybe later goals. Now we have the name and Lincoln where tax is in mourning. Here it is. Your number. Your name on their goals. Read this. Here it is the same result. So I think it is very helpful to have a name assigned to the The items inside of the table will help you a lot rather than the item 12 or three. Maybe you forget about what it's like to one or two over ST. So this is more meaningful. This is even an easier way to the kibbles. So that's it for now to you in the next picture 27. Nested Value Tuples: in this lecture, we'll see. How can we place a value chewable inside of another valuable the nested value trouble, sir. Let's go ahead. How do you the same example? But the player, Lou, I'll go ahead and start having the elements will. Maybe letter number seven, maybe player name, older on. And maybe I would like to store all the goals from the five years or three years so I can go ahead. I have. This is the first year or this year, and this is the previous and this is the previous. So this is one way. But this is not actually very elegant. This is not the best practice. I'd like to plays this in a separate people. And then I'll have the Jubal here. So I'll be adding this clear goals and come to this later. Go ahead and to meet another Tubo older. Those now it's over year to use other certainty. Maybe he scored before goals. Year 1016. In these scored 60 goals is left and haggard information. I'm just adding random numbers. Year 15. Okay, three years from the end, more maybe 50 in here. I can come and make this well No the goals. So you see, I have added it without any problem. And they can come in here and accept this like this. So what? I'll do leaps there. Number are here. ISS We're name and the Blair goals. Now I have access to one of you. Here it is year doing 1017 and 16 and 15. Let's run this. And here it is. And even if I had it, more elements in here no year, maybe one affording previous Ward E 55 in here. They can come again and access this you information, which is 65. So this is how we can blaze that Ubell inside off another terrible in C sharp seven. See you in the next picture. 28. Value Tuples Exercise: Now it's starting for a small exercise about the value troubles. I would like you to go ahead and commit a list which consists off the value troubles and go ahead and use the example of the players. The structure of the trouble should be the player number, the clear name and the gold. I was video. Go ahead and try to do this. Okay? I hope it was easy. Let's go ahead and try to do it together, so I'll be creating a list in here. Well, the B defining the type off the items inside the list, which is five value tables the and player number string their name on and layer goes. I call this list off, clears on created successfully. And of course, you can govern here and all of this 100 blazes with before. No, let's go ahead and try to add items to this list. The list off there's look as you can see. It's telling me that it takes this time here, which is a table of this structure. So now I have access or B Ebeling, too, at the items off the table. In this element to the 1st 1 is when older B 25 goals that would be creating a couple more . Me. Really? I don't remember all the numbers of players. Maybe stem. Maybe he's 45 golds on we can use. You are. I'm just giving it a run them and numbers and goals. Of course. Well, not every accurate information, maybe is 20. You scored maybe seven goals and maybe Missy. Yes, he would be 55 the same as a lot of grand number. Now we have successfully added for items to the list. Let's go ahead and try to this plate. So using the forage on the on team, I'll make it. Blair just naming you can leave it item and the collection would be the last off players. Let's go ahead. I'm trying to display this. What? You just during ejaculation in here late on one line That's aunt for is clear. No, we're number. Maybe he's operated by on them. Layer a clear name. We're here. A player. Gold will be a that the line in here? It's a great player. Okay, let's run. This here is very looked looking, I guess. Course you can use any function off the genetic list so I can use the most of players. You can use a sword. You can use a reverse removed at anything. So just be trying this after the sorting one culture change the list. So here it is. Here's what is that with this sword? Here is with this source. Just try to make it look better. So he's sorting just taking your line. It's from this, and here it is after the sorting. Now we have Ronaldo. It's sorting with the numbers as you can see off the players. So if I change, it may be anymore to be, for example, in one will be number one in the list. Here it is. Then it's changing or sorting based on the next value of the table and assert that took. So that's it about the exercise and the valuables. See you in the next pictures 29. Value Tuples with Methods: Now, let's see. How can we use Value Cube ALS and Message's? So I've been competing Ubell here, pull it again with, although m sticking with the same. Their example. Um, again, the number of a player the name earned the gold, maybe 60 goals. Okay. No, I won't be reading a message that peak this at the perimeter. Think there's value trouble l a preference and this plate will be competing in public. I want let's play clear. Commission on the perimeter of the argument of the message would be and is a player number in a string their name around me, Blair goals. And then I give it a name. So then we went passing a revenue of troubles which consists often end string and course I can remove the names and still gonna work. No, I'll be displaying lair. Remember? On the blue your name? Of course. Harold. Ago. Okay, well defined. Another one here. Maybe rankings. I don't remember. Rang gigs, maybe. I don't know. Maybe given her give it a 10 gigs. Um, 40. Okay. Rankings was playing for Manchester tonight. If you and I don't have this information, he's retired. Okay, Now, let's this play. There's the first school to mess up this play your information. First warm might be passing one elder to the massive. Then I won't be displaying or passing the information gigs. I don't think you want sprayed it using a symbol lighting like this. Let's from this and it is. See now the functions Well, the function. Hopefully this that we have here. Take this doable Alabama and then this play. Okay, I'll use with the value troubles with the message that we can make the return time as of the time of the terrible. What's go ahead and try to do with leaks now it will not be void or a string or insulting. It would be off the time, the same as that you will. So this is the time you know the name. Let me get the same and it will take new brand. But we need to return value so may be able to return. Let's see from the name is messy. Of course, it would go ahead on that information, the nationality or the club that he's playing for, but I'll just keep it simple. Maybe you bowlful 60. Okay, now let's return. Be very loose, which is about you. Trouble. Okay. No, let's go ahead. I'm trying to do this to our be cooling display information in here. This will just return. This will display nothing. This will just return the Jubal. Missy, if you run, this muscle will be displayed. So to display it. Actually, I'll be doing this. I'll be passing. They returned from this message to this message. Okay, let's do this this way. Their information. And it will take a render the return of this message. Okay? It's from this. And now we will see he did the new place. So I hope you get it. This this line here, it's not that complicated. If you think of it this little, it's actually treated. So I'll place a break point in here. Here. That's one in the debugging load. Trying to understand what is happening the first time. It will go to this message in here trying to give the data from this message. So now we have this stupid in here with this data. Then it will go again to this message. Trying to display the date doesn't get from this message in here, which contains the data for Missy. So as you can see now it's displaying Judita and the line, and we're done. Okay. I hope that you get it to you in the next lectures. 30. Summary: congratulations. You've made it to the end of the sector. I know it spend a very long chapter, but I hope that it has some good information for you. So something up would have been discussing. We have been discussing the difference between the non genetic collections and then generic collections. We have seen also the nun generic array lists. We have seen the every good replacement to normal raise, and they can save us time and complication off the erased. We can do almost anything with a ray list, the sword reversed and removed with three easy and basic message use. We have seen all those hash tables we have seen the stacks and the cuse. We have seen the concept off steak and the Cuse, the first and last Allen and the first in First Out. And we have seen the examples in real life off this concepts, wetting also the generic list and have seen that we can use almost every message inside of there. A lists with the generic list like the storage remove, reverse contained and almost every other missing. We have seen also the sort of list and the sort of dictionary, and we have scenes of difference between the certain list and asserted dictionary, the difference in their performance and and the reading from the items inside of this list we have seen also one of the amazing features off seizure general glasses. And how can we can get the generic class we have seen also vegetables and we're seeing the pupils and see sharp for the older tables. And we have seen the value. Jubal. They enhance hman that were done to the tools and introduced and see ships seven. And we have seen that we can add back images or new items or references. Do our system using this and you get manager well, the visual studio. So I hope it's been an interesting chapter. See you in the next picture.