All right.
So let's get familiar with lists.
Therefore I have a new project here.
And I'm going to start by creating a list which I'm going to use like so.
So the you are you use the list keyword with a capital L, then the less than the data type greater
than name of the list equal sign new keyword.
Then the list keyword once again with a capital L, and again less than data type greater than.
And then you need to add the brackets.
After that the opening and closing as well as the semicolon.
So that's how you create a list.
Creating a list and initializing it, or declaring a list and initializing it.
So now we can use that list.
Let's rename it.
Let's call it colors.
So this list is going to hold a bunch of colors.
And now in order to add items to the list I can just go ahead and say colors dot add.
So you see there's this add method and there are more methods.
You can see we just looked at a few in the presentation.
But there are plenty of methods here.
So I'm adding for example red.
Then I'm adding colors dot add and let's say blue.
And then I'm also adding the color green.
So colors dot add.
And here I'm going to use green okay.
So now I have three items inside of my colors list.
And you can see they are all of type string.
So that's really important I cannot go ahead and say colors dot add and then add an int in here.
So that won't work.
Or any other data type either.
So it only works with strings okay.
That's really important.
Now how do I read data of my list.
So how can I get all the items from my list?
Well, the best way is to just use a for each loop.
Okay, so string color in colors and then you display the color.
Okay.
So we could even add something like current colors.
So current colors in the colors list.
And then it just goes ahead.
So let me use console dot read key to keep my program running.
And we will see that we have those three items current colors in the colors list.
Well I could have put that on top maybe red, blue and green.
So we could have put this Console.WriteLine statement outside of the for each loop.
So there you are.
Now this is how you can read all the data from your list.
So in this case from our colors list.
So that's it for this video.
You've seen how to declare a list and initialize it.
And you saw how you can add items as well as read items from the list.
In the next video, we're going to look at how to delete items in our list.
Okay, so see you in the next video.