class Student
{
public string ID { get; set; }
public string Name { get; set; }
}
Student[] students = new Student[10];
int j = 0;
for(int i=0; i < 100; i++)
{
if (some condition)
{
student[j].ID = anotherIDlist[i]; //some value from another list;
student[j].Name = anotherNamelist[i]; //some value from another list;
j++;
}
}
Here I don't know the array length. Need it dynamic depending on the total conditions are true. Is there any efficient way of doing the same using Generic List? If so, how to do so?