Top "Dispose" questions

Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources

When should I dispose my objects in .NET?

For general code, do I really need to dispose an object? Can I just ignore it for the most part …

.net garbage-collection dispose
Should Dispose methods be unit tested?

I am using C#. Is it advised to unit test dispose methods? If so why, and how should one test …

c# unit-testing dispose
How to dispose properly using async and await

I'm trying to make code replacement from Thread to Task. The sleep / delay is just representing long running activity. static …

c# .net multithreading async-await dispose
Unmanaged resources and Dispose()

I was reading some articles about Dispose() method and found that unmanaged resources should be freed explicitly from Dispose() method (…

c# dispose unmanagedresources
Cannot access a disposed object

I am writing a tool to integrate with a web service, I have a method which just builds an ImportExportSoapClient …

wcf web-services dispose wcf-client
Does SqlTransaction need to have Dispose called?

Do I need to call dispose in the finally block for SqlTransaction? Pretend the developer didnt use USING anywhere, and …

.net transactions dispose sqltransaction
How to wait for a single event in C#, with timeout and cancellation

So my requirement is to have my function wait for the first instance an event Action<T> coming …

c# multithreading events asynchronous dispose
C# USING keyword - when and when not to use it?

I'd like to know when i should and shouldn't be wrapping things in a USING block. From what I understand, …

c# dispose
Best practice for disposing Completable, Single, Maybe and terminating Observables in RxJava

I'm asking this from an Android perspective, but this should apply to RxJava in general. As a best practice, should …

android rx-java dispose rx-java2
What happens if I don't call Dispose on the pen object?

What happens if I don't call Dispose on the pen object in this code snippet? private void panel_Paint(object …

c# winforms dispose