spdracer22
Member
- Joined
- Oct 18, 2007
- Messages
- 7
- Programming Experience
- 3-5
I have a structure that keeps track of several different structures that contain fields, and I want to know if it's possible to iterate through these to perform math operations.
My structures go something like this:
What I want to do is something like can be done with collections:
However, because it's not a collection, it won't work right. The idea behind wanting to do things this way, is that I don't have to change my underlying math code if I want to add or remove sub structures from my main structure.
If anyone has any ideas, let me know. It's also early enough in the design/coding phase that I can make some wholesale changes if things would work better another way.
My structures go something like this:
VB.NET:
Structure subStruct
val 1 as double
val 2 as double
val 3 as double
End Structure
Structure mainStruct
sub1 as subStruct
sub2 as subStruct
sub3 as subStruct
End Structure
What I want to do is something like can be done with collections:
VB.NET:
Dim myStruct as mainStruct
For each a as subStruct in myStruct
a.val1 += 1
Next
However, because it's not a collection, it won't work right. The idea behind wanting to do things this way, is that I don't have to change my underlying math code if I want to add or remove sub structures from my main structure.
If anyone has any ideas, let me know. It's also early enough in the design/coding phase that I can make some wholesale changes if things would work better another way.