Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

I have a custom class which represents an item in my shopping basket (e-commerce site)

 

Is there a collection object which I can add all the shopping cart items to (normally I just use a datatable in the session to hold this info) but I want to try it by just adding the collection to the session.

 

Whats the best collection object to use for this?

 

Thanks

Posted

I would inherit from CollectionBase and create a strongly typed custom collection. This way you know any object in the collection is of the correct type, etc...

 

Here's a nifty little example http://www.c-sharpcorner.com/UploadFile/rafidkhalidabdullah/CreatingStronglyTypedCustomCollectionsinCS11302005020315AM/CreatingStronglyTypedCustomCollectionsinCS.aspx

~Nate�

___________________________________________

Please use the [vb]/[cs] tags on posted code.

Please post solutions you find somewhere else.

Follow me on Twitter here.

Posted
I would inherit from CollectionBase and create a strongly typed custom collection. This way you know any object in the collection is of the correct type, etc...

 

Here's a nifty little example http://www.c-sharpcorner.com/UploadFile/rafidkhalidabdullah/CreatingStronglyTypedCustomCollectionsinCS11302005020315AM/CreatingStronglyTypedCustomCollectionsinCS.aspx

 

Nice idea. Even the thought of using a strongly typed custom collection didn't occur to me. :p

Amir Syafrudin

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...