Nest objects->seralize->XML

  • Thread starter Maziar Aflatoun
  • Start date
M

Maziar Aflatoun

Hi everyone,

I like to do the following,

1. Create an object that holds the customer general information
2. Add multiple orders for the customer
3. Serialize and dump to XML

I have already taken care of part 1. and know part 3. However, what the best
of adding multiple orders for 1 customer. Ex.

Can someone please show me an example of adding multiple orders (Order) to
the Customer object? Can be 1 or more Orders.


public class Customer
{
public string FirstName;
public string LastName;

public Customer()
{
}
}

public class Order
{
public string Name;
public string Qty;

public Order()
{
}
}

Thank you
Maz.
 
J

Jianwei Sun

See inline

Maziar said:
Hi everyone,

I like to do the following,

1. Create an object that holds the customer general information
2. Add multiple orders for the customer
3. Serialize and dump to XML

I have already taken care of part 1. and know part 3. However, what the best
of adding multiple orders for 1 customer. Ex.

Can someone please show me an example of adding multiple orders (Order) to
the Customer object? Can be 1 or more Orders.


public class Customer
{
public string FirstName;
public string LastName;
delcare a collection here
private ArrayList Orders;
public Customer()
{
}

public AddOrder(Order order)
{
Orders.Add(order).
}
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top