V
V
Vladislav2020-07-06 10:49:52
C++ / C#
Vladislav, 2020-07-06 10:49:52

List in unity. I can't figure out what a List is and how to use it??

I'm learning C# and noticed that List is often used, but I never understood what List is and how to use it.
I would like to know what List is, why it is needed and how it can be applied in Unity.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
Z
zZaKko, 2020-07-06
@Vladlen234

If, in a simple way, List is an array without a specific number of cells, you can constantly add them there. To wrap a list:

List <Переменная> name = new List <Переменная>();
//Например
List <Int> l = new List<Int>();//Лист , который будет содержать переменные типа Int
Working with such an array is very similar to working with ordinary one-dimensional and multidimensional arrays. Only adding to this array is done with
name.Add(переменная);
//например
l.Add(1);//Добавляем в наш массив переменную со значением 1;
You can also do this with the help of cycles) I told you the simplest thing so that you understand at least a little. You yuopi threw off the link, there you will find everything else)

Y
yuopi, 2020-07-06
@yuopi

Go ahead, the whole Chapter 9 for you
https://metanit.com/sharp/tutorial/4.5.php

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question