Reg - Reflection in array of objects

Mar 26 2013 6:26 AM
Hi,

I have a class which is array of classes. I need to traverse object of this class and do the following:
a. Instantiate object with total number of array size.
        e.g. student[] stu = new student[2];
b. Instantiate each array item in a object
        stu[0] = new student();
        stu[1] = new student();
c. Then will assign value to its properties. Like
        stu[0].name = "Test";
        stu[1].name = "Test1";

This is easy and done simply. But i want to do the same in Reflection, where object will be passed without memory allocation and also its instances. As follows:

student[] stu;
assignValue(stu);

public function assignValue(object studentObj)
{
     /*
        a. Instantiate object with total number of array size
        b. Instantiate each array item in a object
        c. assign value to its properties
      */
      
}

How to achieve this? I tried to set memory allocation and instantiation of each item, but am unable to set value to the object. Can anyone help me?

Thanks and Regards,
Mani

Answers (1)