Linked Questions

1 vote
2 answers
703 views

Possible Duplicate: Do event handlers stop garbage collection from occuring? I had one wp7 application like this: private void button1_Click(object sender, RoutedEventArgs e) { ...
Dozer's user avatar
  • 5,305
0 votes
1 answer
295 views

It's important to mention that the question is about an owned object which its lifecycle will be controlled by the container it is declared in. For an external object which has been assigned from ...
CleanCoder's user avatar
  • 2,937
2 votes
0 answers
240 views

What I'm wanting to do is create a file watcher that is monitoring for any changes in my services config file. When it detects any changes, the service should restart automatically so the changes can ...
N0xus's user avatar
  • 2,754
1 vote
0 answers
66 views

I have a social network, where I can place comments on posts. I havce implemented this using a ReactionController that handles API calls for a post that has an event that indicates that the API call ...
vrwim's user avatar
  • 14.6k
0 votes
0 answers
49 views

Unless I've fundamentally misunderstood the way events and garbage collection work in C#, if an object has subscribed to an event, the event can still be raised on that object, and the event handler ...
Dave's user avatar
  • 3,747
1 vote
0 answers
37 views

If the only thing that ClassA does is to subscribe to events from ClassB -which is a long living class- like this static void Main() { new A(B); } class ClassA { public ClassA(ClassB b) { ...
anouar.bagari's user avatar
55 votes
8 answers
171k views

I found on this link ObservableCollection not noticing when Item in it changes (even with INotifyPropertyChanged) some techniques to notify a Observablecollection that an item has changed. the ...
Pansoul's user avatar
  • 748
52 votes
6 answers
56k views

For some reason, my FileSystemWatcher is not firing any events whatsoever. I want to know any time a new file is created, deleted or renamed in my directory. _myFolderPath is being set correctly, I ...
gwin003's user avatar
  • 8,162
45 votes
6 answers
23k views

What is the best practice for when to implement IDisposable? Is the best rule of thumb to implement it if you have one managed object in the class, or does it depend if the object was created in the ...
Bobby's user avatar
  • 11.6k
34 votes
4 answers
24k views

Is it a good practice to implement event handling through WeakReference if that event is the only thing holding the reference and that we would need the object to be garbage collected? As an ...
8 votes
5 answers
10k views

Since C# uses Garbage Collection. When is it necessary to use .Dispose to free the memory? I realize there are a few situations so I'll try to list the ones I can think of. If I close a Form that ...
Neal's user avatar
  • 609
6 votes
5 answers
2k views

I have the following code (cut down for readability): Main Class: public StartProcess() { Thinker th = new Thinker(); th.DoneThinking += new Thinker.ProcessingFinished(ThinkerFinished); ...
Damovisa's user avatar
  • 19.4k
9 votes
6 answers
5k views

I read the excellent answer explaining how to use the Dispose pattern, and also why it works that way. Proper use of the IDisposable interface The post clearly states that you would want to use the ...
Gabriel G. Roy's user avatar
3 votes
4 answers
176 views

I have a class which has a static List<T> field inside which I hold all my objects; each object represents a process that is running and its properties. After the process finishes its job, the ...
user2813889's user avatar
11 votes
1 answer
2k views

I'm using a FileSystemWatcher (in an ASP.NET web app) to monitor a file for changes. The watcher is set up in the constructor of a Singleton class, e.g: private SingletonConstructor() { var ...
M4N's user avatar
  • 96.8k

15 30 50 per page