Login | Register   
RSS Feed
Download our iPhone app
Browse DevX
Sign up for e-mail newsletters from DevX

By submitting your information, you agree that devx.com may send you DevX offers via email, phone and text message, as well as email offers about other products and services that DevX believes may be of interest to you. DevX will process your information in accordance with the Quinstreet Privacy Policy.

Tip of the Day
Language: VB7
Expertise: beginner
Feb 3, 2003



Building the Right Environment to Support AI, Machine Learning and Deep Learning

Using static variables instead of the Application object

If you want to share a value or an object instance between all the pages of any session, you typically use the Application object. However, a good alternative is to use a public variable defined in a module (VB.NET only), or a static field/property defined in a class. Static properties maintain their values between clients request, and so work like Application variables. They are often a better choice because of their better performace (storing and reading a value can be up to 500 times faster with static variables), since they don't require a lookup in a collection when you refer to them - as it happens for the Application object - and you don't need to cast from Object to a specific type, as you must do with the Application variables (either implicitly or exclicitly, depending on your Option Stric settings), but you store and read a value in a variable or the right type, so no casting and boxing is ever required.
Marco Bellinaso
Comment and Contribute






(Maximum characters: 1200). You have 1200 characters left.



Thanks for your registration, follow us on our social networks to keep up-to-date