It is difficult to understand the fields of the class. Where can I find information so that I understand why such a syntax? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

It is difficult to understand the fields of the class. Where can I find information so that I understand why such a syntax?

T [ ] items; for example?

17th Nov 2017, 10:06 PM
Валерия
Валерия - avatar
2 Answers
+ 1
Can you explain yourself a bit more ? string MyString = "Hello"; is a field string[] MyArray = new string[3]; is a array of three strings The type T can be any type, that makes it flexible and complex. It great if used correctly but difficult to understand. It is called generic. So in your array "items" your can store strings and also integers. This is defined when the array is created https://www.dotnetperls.com/generic
20th Nov 2017, 8:15 PM
sneeze
sneeze - avatar
0
Thank you, I really helped your answer☺️
21st Nov 2017, 8:28 AM
Валерия
Валерия - avatar