So pretty much, what I'm trying to do is create a properties grid. It will hold things like input 0-5 or like output 1-64, which will have sub-properties like name, id, etc. Right now my code is very straight forward, and I initialize each one individually. That caused a problem when I wanted to save them to a text file and realized that doing it that way will cause walls of code. Instead of just being able to do a for loop, I would have to grab each one individually to write to the text file. I was wondering if there was a better approach to doing this with an array or list.
Here is what I have right now:
[CategoryAttribute("Input 0"), DescriptionAttribute("Name of Input 0"), DisplayName("Input 0: Name")]
public string IName_0
{
get {return _Iname[0];}
set {_Iname[0] = value;}
}
[CategoryAttribute("Input 0"), DescriptionAttribute("ID of Input 0"), DisplayName("Input 0: ID")]
public int IID_0
{
get { return _IID[0]; }
set { if ((64 > value) && (value >= 0)) _IID[0] = value; }
}
[CategoryAttribute("Input 1"), DescriptionAttribute("Name of Input 1"), DisplayName("Input 1: Name")]
public string IName_1
{
get { return _Iname[1]; }
set { _Iname[1] = value; }
}
[CategoryAttribute("Input 1"), DescriptionAttribute("ID of Input 1"), DisplayName("Input 1: ID")]
public int IID_1
{
get { return _IID[1]; }
set { if ((64 > value) && (value >= 0)) _IID[1] = value; }
It goes on like that for each input. I have been looking everywhere, and I can't find a good fix.