create collection of collection

  • Thread starter Thread starter Hemant
  • Start date Start date
H

Hemant

Hi,
I want to create collection array .
the detail for this is as below.
i have a product object
i have created a arraylist collection of product as productlist
now i want to create collection of productlist in which i can put more than
one type of productlist .
for example
i have one productlist in which i have products with veg and the i have
other productlist in which i have non veg products .
i can make a extra db trip to get veg and non veg product but all can be
done in one tirp is better.
i will fetch them in dataset and than stored to the array list .

how to do this ?
can you help me to solve this problem?

thanks,
hemant
 
Hi,
I want to create collection array .
the detail for this is as below.
i have a product object
i have created a arraylist collection of product as productlist
now i want to create collection of productlist in which i can put more
than one type of productlist .
for example
i have one productlist in which i have products with veg and the i
have other productlist in which i have non veg products .
i can make a extra db trip to get veg and non veg product but all can
be done in one tirp is better.
i will fetch them in dataset and than stored to the array list .

how to do this ?
can you help me to solve this problem?

You really have not given enough info to "solve" the problem, but here
are some ideas you can mull around.


public class ProductList : List<Product>
{
}

public class Product
{
}

public class VegProduct : Product
{
}

public class NonVegProduct : Product
{
}

public class SuperProductList: List<ProductList>
{
}

This is just one idea. The VegProduct/NonVegProduct are not necessary if
there are no unique fields.

Another idea is to use a dictionary (or dictionary type) generic type so
you can have lists like this:

public class SuperProductList: Dictionary<string, ProductList>
{
}

You can then make the string an indicator of type of product in the
list.


Peace and Grace,


--
Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA

Twitter: @gbworld
Blog: http://gregorybeamer.spaces.live.com

*******************************************
| Think outside the box! |
*******************************************
 
Back
Top