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 GetObject(string name) … Read more
Is it safe to use the using statement on a (potentially) null object? Consider the following example: class Test { IDisposable GetObject(string name) … Read more
DataSet and DataTable both implement IDisposable, so, by conventional best practices, I should call their Dispose() methods. However, from what I’ve read so … Read more
Something like: using (IDisposable disposable = GetSomeDisposable()) { //….. //…… return Stg(); } I believe it is not a proper place for a … Read more
In .NET, under which circumstances should I use GC.SuppressFinalize()? What advantage(s) does using this method give me? 5 Answers 5
System.Net.Http.HttpClient and System.Net.Http.HttpClientHandler in .NET Framework 4.5 implement IDisposable (via System.Net.Http.HttpMessageInvoker). The using statement documentation says: As a rule, when you use an … Read more
C# 2008 I have been working on this for a while now, and I am still confused about the use of finalize and … Read more
I know from reading the Microsoft documentation that the “primary” use of the IDisposable interface is to clean up unmanaged resources. To me, … Read more