Re: Generics in Cache

Tech-Archive recommends: Speed Up your PC by fixing your registry



Putting something in the cache doesn't involve serializing it. The cache (and the session and application objects) are just collections that you're adding to.

Perhaps you're thinking of ViewState, which requires that objects added to it be serializable because their references aren't added to ViewState, a serialized copy is added. This allows the object contents to be stored in the viewstate.

I don't know where you read that generics can't be serialized. Check this out:

www.devx.com/dotnet/Article/30158/0/page/2

--Bob

INeedADip wrote:
Can I put a generic List<MyObject> in cache?
I read that generics can't be serialized..

Can I cache them? Can I return them from Web Services?


.