Well I have a class like this and I want to store in a list which is defined as a static variable. I was following the reference here: Storing data into list with class
public class Faculty
{
public string Name { get; set; }
public string Dept { get; set; }
public string[] subInterest = new string[4];
}
However when I try to initialize the list as follows I have problem with the array part: Invalid initializer member declarator
SaveDirectory.list_of_faculty.Add(
new Faculty
{
Name = txtTeachherName.Text,
Dept = cmbDepts.Items.CurrentItem.ToString(),
subInterest[0] = "HELLO"
});
What am I doing wrong?