I have a group of 13 properties in a class. I created a struct for these properties and passed it to another class.
I need to add another 10 groups of these 13 properties. So thats 130 properties in total.
What do I do?
1.I could add all 130 properties to the struct. Will this affect performance and readability
2.I could create a list of structs but don’t know how to access an item
eg.
to add to the list:
listRowItems.Add(new RowItems(){a=1, b=1, c=1, d=1…});
listRowItems.Add(new RowItems(){a=2, b=2, c=2, d=2…});
How do I access the second group item b?
3.Could I use just a dictionary with 130 items
4.Should I use a list of dictionaries (again I don’t know how to access a particular item)
5.Should I pass in a class of 130 properties
Just for your interest the properties are css parameters used for a composite control. The control displays 13 elements in each row and there are 10 rows and each row is customisable.
Why not just pass an instance of the class to the other class? It’s not clear to me why the properties need to be in another data structure. If you want to limit the properties the other class can access, you can define an interface and implement it on class A then type the argument in the method that receives the class B as the interface type.