c# add item to array of objects code example
Example 1: add items to a class array
class Student
{
IList<Subject> subjects = new List<Subject>();
}
class Subject
{
string Name;
string referenceBook;
}
//Now you can say:
someStudent.subjects.Add(new Subject());
Example 2: add item to an array c#
List<string> l = new List<string>(){"one","two","tree","four",};