Add items to array within classes
<p>I am new to programming in C#. I guess it might be a very easy solution which I am not aware of .</p>

<p>Suppose I have a class file </p>

<pre><code>using System;
using System.Collections.Generic;

namespace sharepointproject1
{
    public partial class School
    {
        public students[] students { get; set; }
    }

    public partial class student
    {
        public marks[] marks;
        public extraactivites[] extraactivities;
    }
    public partial class marks
    {
        public int m1 { get; set; }
        public int m2 { get; set; }
    }
    public partial class extraactivities
    {
        public decimal m5;
        public decimal m6;

    }
}
</code></pre>

<p>Now in aspx.cs file how do I add marks to the array declared?</p>

<pre><code>namespace sharepointproject1
{
    public partial class testing : usercontrol
    {
        School school = new school();
        protected void Page_Load(object sender, EventArgs e)
        {
            school.students[0].marks[0].mark1 = 45;
        }
    }
}
</code></pre>

<p>I need to dynamically add items to it at run time. How do I do that? Do I have to change the array to list array in the class file..Hope I am making some sense out of my question.Later I need to bind the marks to the gridview.</p>

<p>Please help!</p>
