Atlanta Custom Software Development 

 
   Search        Code/Page
 

User Login
Email

Password

 

Forgot the Password?
Services
» Web Development
» Maintenance
» Data Integration/BI
» Information Management
Programming
  Database
Automation
OS/Networking
Graphics
Links
Tools
» Regular Expr Tester
» Free Tools

Using static variables instead of the Application object

Total Hit ( 3521)

Rate this article:     Poor     Excellent 

 Submit Your Question/Comment about this article

Rating


 


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.


Submitted By : Nayan Patel  (Member Since : 5/26/2004 12:23:06 PM)

Job Description : He is the moderator of this site and currently working as an independent consultant. He works with VB.net/ASP.net, SQL Server and other MS technologies. He is MCSD.net, MCDBA and MCSE. In his free time he likes to watch funny movies and doing oil painting.
View all (893) submissions by this author  (Birth Date : 7/14/1981 )


Home   |  Comment   |  Contact Us   |  Privacy Policy   |  Terms & Conditions   |  BlogsZappySys

© 2008 BinaryWorld LLC. All rights reserved.