Using static variables instead of the Application object

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.

Share the Post:
Heading photo, Metadata.

What is Metadata?

What is metadata? Well, It’s an odd concept to wrap your head around. Metadata is essentially the secondary layer of data that tracks details about the “regular” data. The regular

XDR solutions

The Benefits of Using XDR Solutions

Cybercriminals constantly adapt their strategies, developing newer, more powerful, and intelligent ways to attack your network. Since security professionals must innovate as well, more conventional endpoint detection solutions have evolved

AI is revolutionizing fraud detection

How AI is Revolutionizing Fraud Detection

Artificial intelligence – commonly known as AI – means a form of technology with multiple uses. As a result, it has become extremely valuable to a number of businesses across

AI innovation

Companies Leading AI Innovation in 2023

Artificial intelligence (AI) has been transforming industries and revolutionizing business operations. AI’s potential to enhance efficiency and productivity has become crucial to many businesses. As we move into 2023, several