So, I recently wrote a program for a class that involved writing an aggregate class to a file. This particular program had an order object, and each order could have 10 ice cream cones, so a ToString() of the class would look like this:
Order Number: 1
Customer #1: Harrington, Honor
Ice Cream Cone: Scoops: 1, Cone Cost: $1.25, Pickle
Ice Cream Cone: Scoops: 1, Cone Cost: $1.25, Tangarine
Ice Cream Cone: Scoops: 1, Cone Cost: $1.25, Nectarine
Ice Cream Cone: Scoops: 1, Cone Cost: $1.25, Orange
Ice Cream Cone: Scoops: 1, Cone Cost: $1.25, Chocolate
Ice Cream Cone: Scoops: 1, Cone Cost: $1.25, Fudge
Yogurt Cone: Scoops: 1, Cone Cost: $1.25, Pickle
Yogurt Cone: Scoops: 1, Cone Cost: $1.25, Tangarine
Yogurt Cone: Scoops: 1, Cone Cost: $1.25, Nectarine
Yogurt Cone: Scoops: 1, Cone Cost: $1.25, Orange
Total Price: $12.50
Is there any right way to do this? Would the aggregates be seperated into seperate files? What I ended up doing was attempting to read a certain class from the file, and if an exception occurred I would roll back the file stream and try to read the other class. The order information was there regaurdless.