New to c# and object oriented I am creating predefined data held in structs (that will not change). and I want to add a reference to those structs in either an array or a list The thought process is to then loop through an array of these structs and if the filter criteria is met, to then add an element of the struct "Displayname" to a listbox Example I am using here is for an array
public struct ListboxData
{
public string Category;
public string Displayname;
public string ID;
public List<string> IDTags;
public string FaultTxt;
public string Suggestion;
public string Comments;
public List<string> MoreQuestions;
}
public ListboxData COOLING = new ListboxData
{
Category = "CATEGORY",
Displayname = "COOLING",
ID = "CAT_COOL",
IDTags = { ""},
FaultTxt = "",
Suggestion = "",
Comments = "",
MoreQuestions = { ""}
};
Having now created multiple instances of the ListboxData structs I then want to add a selection of some of these structs to an array. In this case the Struct reference COOLING
Example of what I am trying to achieve
public ListboxData[] ARRAYofCATEGORIES =
{
COOLING
};
How can I achieve this ?