Session, MVC, Struts and Collection objects

P

pxm4

I'm working on a Content Management Server project developing a MVC
based on a dynamic place holder control. One thing that I have some
questions about is session management. What I would like to do is mimic
the behaviour found in the helper bean in Stuts, BUT make it more
generic. I would like to create a class that stores mulitple
collections or strings based on a generic add method. Can generics do
this? This way I can add collections or single item strings, persist
this one helper object via ASP.NET session and allow the controls to
get their specific strings or collection on initialize via a get
accessor. So there would be an add method that accepts a object say a
collection or a string and maps it with a name. Then using the
get("name") it would automatically return the object with the type for
use. Thanks!
 
K

Kevin Yu [MSFT]

Hi,

First of all, I would like to confirm my understanding of your issue. From
your description, I understand that you need to compose a class that can
store multiple collections of object with different types. If there is any
misunderstanding, please feel free to let me know.

Could you let me know if the type of objects are the same in one
collection? If so, I don't think you need to use generic. HashTable will be
a good choice. You can add an object to the table and get its values with
key. If you need multiple collections, just make multiple HashTables.
Please check the following link for more information.

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/
frlrfsystemcollectionshashtableclasstopic.asp

Kevin Yu
=======
"This posting is provided "AS IS" with no warranties, and confers no
rights."
 

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