Top "Idisposable" questions

IDisposable is an interface within the Microsoft .NET Framework's Base Class Library (BCL).

Determine managed vs unmanaged resources

There are lots of questions about managed vs unmanaged resources. I understand the basic definition of the two. However, I …

c# .net resources idisposable
Should Dispose() or Finalize() be used to delete temporary files?

I have a class that makes use of temporary files (Path.GetTempFileName()) while it is active. I want to make …

c# .net idisposable temporary-files
Unity 2.0 and handling IDisposable types (especially with PerThreadLifetimeManager)

I know that similar question was asked several times (for example: here, here,here and here) but it was for …

c# .net inversion-of-control unity-container idisposable
Declare IDisposable for the class or interface?

Starting from the follwing situation: public interface ISample { } public class SampleA : ISample { // has some (unmanaged) resources that needs to be …

c# .net dispose idisposable
Should IDisposable.Dispose() be made safe to call multiple times?

Should implementations of IDisposable make Dispose() safe to call multiple times? Or the opposite? What approach to most .NET Framework …

c# .net idisposable
Who should call Dispose on IDisposable objects when passed into another object?

Is there any guidance or best practices around who should call Dispose() on disposable objects when they have been passed …

c# .net idisposable
How do you reconcile IDisposable and IoC?

I'm finally wrapping my head around IoC and DI in C#, and am struggling with some of the edges. I'm …

c# inversion-of-control unity-container idisposable
Should a .Net/C# object call Dispose() on itself?

Below is some sample code written by a colleague. This seems obviously wrong to me but I wanted to check. …

c# .net web-services dispose idisposable
Should I call Close on HttpWebResponse, even if it's inside a using statement?

I have some code like, this code is used very heavily: using (HttpWebResponse r = _GetHttpWebResponse(uri, body, method, contentType, headers)) { /* …

.net garbage-collection idisposable
How do I dispose my filestream when implementing a file download in ASP.NET?

I have a class DocumentGenerator which wraps a MemoryStream. So I have implemented IDisposable on the class. I can't see …

c# asp.net asp.net-mvc streaming idisposable