Help with List function

After looking at the Unity tutorial on lists it still dosnt make sense to me…

The List I plan on using is for a inventory.

I need to break the following line down so I can understand it

List<Inventory01> Inventory02 = new List<Inventory01>();

As far as i am aware, Inventory02 is the name of the list, but what do the Inventory01 mean? I understand that they must be the same in both <>But what are they?

List<Inventory01> Inventory02 = new List<Inventory01>()

The first List is the decleration of the list, and what the contents of the list is going to be.

Inventory02 is indeed the name of the list, and lastly, you create a new instance of a list, containing Inventory01.

E.g.

	List<string> list1 = new List<string>()
	{
	    "carrot",
	    "fox",
	    "explorer"
	};

First we decalre, that we are going to make a list, containing strings. Next, we give that list a name, and “create”.

I’m sorry, I can’t seem to wrap my head around a better explanation right now. :slight_smile:

You could take a look here, maybe:

Cheers! The link looks very helpful Adds to favs

One last thing.
The List, between the <> is the data type correct?
So string, int, bool etc.

Absolutely correct, sir!

Correct.

string, int, YourNewDataType, etc…