473,529 Members | 2,487 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

how to have a list(?) of instances without preventing garbage collection

Dear all,

I create a big number of a class instances of some class. Sometimes this
instances must be collected (all pointers are deleted, but instance is not
explicitly disposed).But sometimes I need to notify all living instances to
reread an init file.

Since I don't want to prevent a garbadge collection of the instances I don't
have an explicit collection of all living instances. So I am trying to use
shared event for notification.

But it seems that event delegate still preventing instances from GC.

Is it possible to somehow notify all living instances of class without
preventing a garbage collection?

Thanks a lot,

Boni
Nov 23 '05 #1
3 857
Is the System.WeakReference class something you need?
-------------
Thi - http://thith.blogspot.com

Nov 23 '05 #2
You need to search these newsgroups and the web for "weak reference
event handler". There are quite a few sites out there that tell you how
to build them. (Some designs are better than others.)

I had to do this in my system for similar reasons: objects subscribing
to static events that were then held forever because the event chain
held references to them.

Nov 23 '05 #3
Yep,
it is exactely what I need.
But I could not find a way to make a weak shared(static) handlers in .NET
1.1. Is it possible?
Could you point some info? (may be code sniplets or ideas?)

Thanks a lot in advance, Boni

"Bruce Wood" <br*******@canada.com> schrieb im Newsbeitrag
news:11**********************@o13g2000cwo.googlegr oups.com...
You need to search these newsgroups and the web for "weak reference
event handler". There are quite a few sites out there that tell you how
to build them. (Some designs are better than others.)

I had to do this in my system for similar reasons: objects subscribing
to static events that were then held forever because the event chain
held references to them.

Nov 23 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

12
6995
by: Steven Bethard | last post by:
So I need to do something like: for i in range(len(l)): for j in range(i+1, len(l)): # do something with (l, l) where I get all pairs of items in a list (where I'm thinking of pairs as sets, not tuples, so order doesn't matter). There isn't really anything wrong with the solution here, but since Python's for-each construction is so...
5
67661
by: Howard Martin | last post by:
I have a page at http://www.develop.check.com.au/hols/ where I'm trying to put a navigation strip on the left of the page. Try as I may, I can't get rid of the bullets and move the list over to the left. The HTML is: <ul> <li><a href="area.html?a=ah">Alexandra Headland</a></li> <li><a href="area.html?a=ca">Caloundra</a></li> <SNIP>
2
2005
by: VK | last post by:
A while ago there was a discussion how to implement a select list that would call a function right upon new selection is being made w/o clicking any additional buttons: ...
3
1537
by: Gregor Horvath | last post by:
Hi, given the dynamic nature of python I assume that there is an elegant solution for my problem, but I did not manage to find it. I have a file that contains for example on line: when I read the file
4
2299
by: TaeHo Yoo | last post by:
I have two dropdown list(ie State and Region) that are populated with data from database. I want to repopulate the second dropdown list(Region) according to what state user has selected without posting back to the server. How do I implement this? Thanks a lot in advance.
5
34933
by: Steven Baggs | last post by:
Hi!, I have defined a List<T> like this List<Container> Container class holds my Item object and it's state as a Enum. Container.Item Container.State I would like to bind it to GridView.
11
4960
by: pompair | last post by:
Hi, Does anyone know how to use anonymous types in a list? I mean, if you define in your code three anonymous types: new {FirstName = "Donald", LastName = "Duck"}; new {FirstName = "Mickey", LastName = "Mouse"}; new {FirstName = "Minnie", LastName = "Mouse"};
10
10477
by: Aditya | last post by:
Hi All, I would like to know how it is possible to insert a node in a linked list without using a temp_pointer. If the element is the first element then there is no problem but if it is in between then what is the best solution.
3
4747
by: daokfella | last post by:
I simply want to extend the List<Tobject to include a property called VirtualCount. Basically, the list will hold my paged records, but the VirtualCount property will tell me how many records total are in the result set. It seems easy enough to create my class: public class EntityList<T: List<T> { public int VirtualCount { get; set; } }
4
1440
by: unknown198790 | last post by:
Well in web server there will be many dormant content and inactive account user. These things will just occupy the space. So in order to free up the space i would like to develop a program that will automatically delete those above mention by using some various parameter. So please help me
0
7269
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7671
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7258
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
7614
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
5809
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
0
4835
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3335
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3330
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1719
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.