I have what might seem like a simple question, but for some reason I am having a problem getting my brain around the concept of having a object with multiple object with in it. For example lets say we have a object with a header and a footer with multiple objects in between.
Like a report, the header would have the name and address. The footer would have a total of the item that where bought. In between would be the line items with the part number, description and a price.
I guess the I can have a object with an header, footer and an array of line item object, all with their own properties. I am using a report as the example, because it’s the only concept that I can think of that will get close to explaining my question.
Can someone please send me a link to or explain on how to create this type of object(s).
I am using VS 2010 and VB.net and I can translate from C# to VB.
Report Object
Header Object
Property Name
Property Date
End
LineItem() Array Object
Property Part Number
Property Part Description
Property Number of Items
Property Per Item Price
Property Total price
End
Footer Object
Property Total Items count
Property Total Price
End
End
You need to create a class for each type of object. It's best to give each of them their own file.
Use it like so:
Jeff, in c# and at its most basic:
Some of the properties are of course computed, rather than get/set.
[edit] - thought it'd be good practice to add a bit of usage, as I saw you ask Douglas this question (more than likely from DB or other source):
now apply report to your canvas surface (html etc..)
Hope this scans ok... pushed it to community wiki (via edits), as it's a universally sought after topic.
[btw] - altho you'll be aware of c# to vb.net convertors, I tried this one and it looks pretty promising: http://www.developerfusion.com/tools/convert/csharp-to-vb