I am trying to add a few rows I got from a DataTable to my list using this struct:
protected struct roleProperties
{
    public string roleName { get; set; }
    public string[] functionTitle { get; set; }
}
As you can see I want more strings inside the method Title string
I have been trying to do it like this:
public void getRoleFuncs(int roleId)
{
    List<roleProperties> roles = new List<roleProperties>();
    int i = 1;
    SqlParameter ro_id = new SqlParameter("@ro_id", roleId);
    string q = "SELECT ro_name, fu_title FROM roles INNER JOIN rolefunctions ON roles.ro_id = rolefunctions.fk_role_id INNER JOIN functions ON rolefunctions.fk_func_id = functions.fu_id WHERE ro_id = @ro_id";
    SqlDataReader r = gm.returnReader(q, ro_id);
    while (r.Read())
    {
        roleProperties item = new roleProperties();
        item.roleName = r["ro_name"].ToString();
        foreach (IDataRecord str in r)
        {
            item.functionTitle[i] = r["fu_title"].ToString();
            i++;
        }
        roles.Add(item);
    }
}
But I get a null reference on this line:
item.functionTitle[i] = r["fu_title"].ToString();
Can anyone see what I am doing wrong?
 
     
     
     
     
    