Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Collection is removed from memory after a while
Message
 
 
To
15/11/2013 13:55:53
General information
Forum:
ASP.NET
Category:
Coding, syntax and commands
Environment versions
Environment:
VB 9.0
OS:
Windows 7
Network:
Windows 2003 Server
Database:
MS SQL Server
Application:
Web
Miscellaneous
Thread ID:
01588067
Message ID:
01588086
Views:
22
>>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?

I like Gregory's approach in the message I just read with a Dictionary. Of course, it's C# code, but I hope it translates well into VB.NET
If it's not broken, fix it until it is.


My Blog
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform