Top "Idisposable" questions

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

How does one tell if an IDisposable object reference is disposed?

Is there a method, or some other light-weight way, to check if a reference is to a disposed object? P.…

c# .net dispose idisposable
How and when are c# Static members disposed?

I have a class with extensive static members, some of which keep references to managed and unmanaged objects. For instance, …

c# .net dispose idisposable
Dispose, when is it called?

Consider the following code: namespace DisposeTest { using System; class Program { static void Main(string[] args) { Console.WriteLine("Calling Test"); Test(); …

c# .net garbage-collection dispose idisposable
Using statement vs. IDisposable.Dispose()

It has been my understanding that the using statement in .NET calls an IDisposable object's Dispose() method once the code …

c# .net vb.net using idisposable
What's the point of overriding Dispose(bool disposing) in .NET?

If I write a class in C# that implements IDisposable, why isn't is sufficient for me to simply implement public …

c# .net dispose idisposable
Will Dispose() be called in a using statement with a null object?

Is it safe to use the using statement on a (potentially) null object? Consider the following example: class Test { IDisposable …

c# idisposable using
Will the Garbage Collector call IDisposable.Dispose for me?

The .NET IDisposable Pattern implies that if you write a finalizer, and implement IDisposable, that your finalizer needs to explicitly …

.net dispose idisposable
What happens if i return before the end of using statement? Will the dispose be called?

I've the following code using(MemoryStream ms = new MemoryStream()) { //code return 0; } The dispose() method is called at the end of …

c# .net dispose idisposable using-statement
Create a temporary file from stream object in c#

Given a stream object which contains an xlsx file, I want to save it as a temporary file and delete …

c# stream idisposable using