c# put object in class array code example
Example 1: c# add object to array
Array.Resize(ref objArray, objArray.Length + 1);
objArray[objArray.Length - 1] = new Someobject();
Example 2: add items to a class array
class Student
{
IList subjects = new List();
}
class Subject
{
string Name;
string referenceBook;
}
//Now you can say:
someStudent.subjects.Add(new Subject());