Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Collection is removed from memory after a while
Message
De
15/11/2013 13:55:53
 
 
Information générale
Forum:
ASP.NET
Catégorie:
Code, syntaxe and commandes
Versions des environnements
Environment:
VB 9.0
OS:
Windows 7
Network:
Windows 2003 Server
Database:
MS SQL Server
Application:
Web
Divers
Thread ID:
01588067
Message ID:
01588075
Vues:
30
>I am trying to mentally translate this line Dim loObject(4) As Object
>
>into C# code and I can not. May be because of my not knowing C# well enough.
>
>What this line does in VB.NET?

Dim loObject is simply a variable declaration. It could have been Dim x. The fact that I assign an arrary to it, in this case 4, is simply for readability and a better recognition so I know how many items will be part of it. This is not necessary.

The type Object is because in loObject, I can store various types. So, I have a string for 1, integer for 2 and 3, and a string for 4. I also already created a three dimensional approach like this by adding a type of object inside the object itself allowing me to add an item in the collection which was an object, and among its various items per object, another object was part of it. So, it is kind of an infinite approach if you want allowing you to go as far as you want to store as much information as needed from one central point.

Such an approach wouldn't apply to a name collection base. I have that as well for loading the entire data dictionary in memory. But, for little content like this, I prefer to use collections. However, this one is new. Collections are usually used in the framework at class level and they are use for a fraction of a second and released from memory after. This one is plugged directly to the oApp application object to live for the entire application lifetime. This is where I think is a flaw in .NET, such as mentioned in various locations on the net, recommending to use an array instead if this has to be used in an intensive way.

Does this provide the explanation you were looking for? With that information in hand, would you see an array to be a better approach?
Michel Fournier
Level Extreme Inc.
Designer, architect, owner of the Level Extreme Platform
Subscribe to the site at https://www.levelextreme.com/Home/DataEntry?Activator=55&NoStore=303
Subscription benefits https://www.levelextreme.com/Home/ViewPage?Activator=7&ID=52
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform