I have an array of type Material that I want to split into smaller groups. A Material is an object composed of a Type, Description, and Value. I want to display the materials' Description and Value grouped together by Type so that I can display them sort of like this:
For Each matTypeGroup As Material() In matTypeGroups
DisplayTypeName(matTypeGroup(0).Type)
For Each mat As Material In matTypeGroup
DisplayMaterialInfo(mat.Description, mat.Value)
Next
Next
The final output would look something like this:
- Type1
Description1: Value1
Description2: Value2
Description3: Value3
- Type2
Description4: Value4
- Type3
Description5: Value5
Description6: Value6
How do I split the Material array into an array of Material arrays grouped by Type?