PC Review


Reply
Thread Tools Rate Thread

create collection of collection

 
 
Hemant
Guest
Posts: n/a
 
      22nd Oct 2009
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


 
Reply With Quote
 
 
 
 
Gregory A. Beamer
Guest
Posts: n/a
 
      22nd Oct 2009
"Hemant" <(E-Mail Removed)> wrote in
news:(E-Mail Removed):

> 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! |
*******************************************
 
Reply With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Collection problems (create Collection object, add data to collection, bind collection to datagrid) Řyvind Isaksen Microsoft ASP .NET 1 18th May 2007 10:24 AM
Collection problems (create Collection object, add data to collection, bind collection to datagrid) Řyvind Isaksen Microsoft Dot NET 1 18th May 2007 10:24 AM
Can't get collection to save when using collection of custom class as property of control in VS 2005 J.Edwards Microsoft Dot NET Compact Framework 0 10th Jan 2006 04:44 AM
key/value collection that allows key string to be updated and retains collection item entry order dx Microsoft Dot NET Framework 2 25th Sep 2004 05:51 PM
Item Collection Editor doesn't preserve collection Andrés Giraldo Microsoft ASP .NET 2 25th Mar 2004 08:38 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 06:37 AM.