Friday, April 24, 2015

Adding object

Does the Course class have a Student[] object in it? If so you can just do course.Students = myStudents;

Assuming the object in the course class is called Students.

public class course
{
    public Student[] Students
    {
        get;
        set;
    }
}

public class MyApp
{
     Course c = new Course();
     Student[] myStudents = Student[5];
     myStudents[0] = ..... // And so on

     c.Students = myStudents;
}

No comments:

Post a Comment