Storing Objects at the Application Level

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

My background is in web development using ASP.NET. When I program with
ASP.NET I have both Application and Session objects available to store
objects. Is there an equivalent in WindowsForms?

Currently my solution is to create a private shared collection and use two
public shared functions on the master/parent form (I have a MDI Form setup)
that add and retrieve objects from the collection. I create a new GUID and
use it as the key to the collection object, and pass the GUID around to each
dependent form. Since the master/parent form is always available while the
application is running, this approach works.

This doesn't seem like the elegant solution. Is there a better process?
Thanks.
 
Hi jmh,

Thanks for your post.

Based on my understanding, you want to get an application level collection
depository.

I think there is a lot of ways to get this done. First, we may use a class
with private constructor and several static properties for the applicaiton
level depository. This is what Environment class does.

Also, we can leverage Singlton pattern, just create a static GetInstance
method, which returns the single class instance for the caller.

However, if you want the collection function like Applicaiton["item"], our
application level class should implement IList interface. Also, in our
IList implement, we can just leverage ArrayList or other collection classes
to store the objects.
=====================================================
Thank you for your patience and cooperation. If you have any questions or
concerns, please feel free to post it in the group. I am standing by to be
of assistance.

Best regards,
Jeffrey Tan
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.
 
Hi jmh,

Does my reply make sense to you? If you still have any concern, please feel
free to tell me, thanks

Best regards,
Jeffrey Tan
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.
 
Back
Top